Add User to Group in Linux

Add an Existing User to a Group

sudo usermod -a -G newgroupname username

Add an Existing User to Multiple Groups in One Command

sudo usermod -a -G newgroup1,newgroup2 username

Remove a User From a Group

sudo gpasswd -d username groupname

Create a Group

sudo groupadd groupname

Delete a Group

sudo groupdel groupname

Display User Groups

id username


Leave a Reply

Your email address will not be published.