Add a user to a group
Hello, recently I'm too busy to write the blog, sorry about that.
Today I gonna tried to add my user to the group.
Since I using the Samba server, I set some file can be accessed by specific people.
So... let's start.
First of all, if you use groups , you will get something like this
edwinlai@edwinlai:~$ groups edwinlai adm cdrom sudo dip plugdev lpadmin sambashareTo create a new group :
edwinlai@edwinlai:~$ sudo groupadd my_groupNow we want to add a user into the group!
Also, you can add user to multiple group at once.
edwinlai@edwinlai:~$ usermod -a -G group useredwinlai@edwinlai:~$ usermod -a -G group1,group2,group3 userAnd if you know what is primary group , we can change use's primary group by this command:
edwinlai@edwinlai:~$ usermod -g group userNow you can use groups to see the groups include the user
edwinlai@edwinlai:~$ groups userFinally, we want to create a new user and add it to the group we want.
edwinlai@edwinlai:~$ useradd -g group new_user
Ok~ that's it. Thanks for reading hope this are useful.
provide |
Comments
Post a Comment