To add a new group to a Linux system, enter this command as root.
root@neo:/home/jason# groupadd dept |
Then, create our new user with this command.
root@neo:/home/jason# useradd -m -g dept -d /home/user -s /bin/bash user |
Now our user is a member of the dept group.
user@neo:/home/jason$ groups dept |
To add an existing user on a Linux system to a group, use this command.
root@neo:/home/jason# usermod -a -G jason user |
Now we can see that the new user is a member of the jason group as well.
user@neo:/home/jason$ groups dept jason |
That is how easy it is to edit and create user group memberships on Linux. I hope this is very helpful to you.
More information on the usermod command here: http://www.securitronlinux.com/linux-mint-2/how-to-edit-user-accounts-on-linux-mint-with-the-usermod-command/