Low Orbit Flux Logo 2 D

Linux How To Add User To Group

Add a user to a group:

sudo usermod -a -G groupname username

Add a user to multiple groups:

sudo usermod -a -G group1,group2 username

NOTE - Using “-a” appends additional groups. If you leave this out any non-specified groups will be removed.

Set user to be a member of only these groups ( remove from all others ):

sudo usermod -G group1,group2 username

Remove user from this group:

sudo gpasswd -d username groupname     

Use either command to show which groups a user belongs to:

id username
groups username

Create a new group:

sudo groupadd groupname

Delete a group:

sudo groupdel groupname

Edit /etc/group directly

vi /etc/group

Add a single user:


Add multiple users:


Manually create a group by adding a line like this. Make sure the group name (ex: test5) and group id (ex: 1005) are unique.