adduser username group | usermod -g | usermod -a -G ,

add user into guest group
$ sudo adduser john guest
Alternatively, you can use the command usermod to modify the group assigned to the user:
$ sudo usermod -g <group> <username>
To add a user to multiple groups, use the following command:
$ sudo usermod -a -G <group1>,<group2>,<group3> <username>
This will add <username> to <group1><group2>, and <group3>Without flag –a, any previously assigned groups will be replaced with new groups.

List assigned groups
ubuntu2@ubuntu2:~$ groups
ubuntu2 adm cdrom sudo dip plugdev lpadmin sambashare
ubuntu2@ubuntu2:~$ groups sftpuser1

sftpuser1 : sftpuser1 sudo

Comments

Popular posts from this blog

HAproxy logging

teamcity Automatic Agent Start under Linux

NFS mount add in fstab _netdev instead of default | firewall-cmd --list-all