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 sambashare 
To create a new group :
edwinlai@edwinlai:~$ sudo groupadd my_group
Now 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 user
And if you know what is primary group , we can change use's primary group by this command:
edwinlai@edwinlai:~$ usermod -g group user
Now you can use groups to see the groups include the user
edwinlai@edwinlai:~$ groups user
Finally, 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

Popular posts from this blog

UBoot with iMX6 - Part 1

Install chrome on CentOS

Can't find pip3 ? Here is it!