How to Add a User to a Group in Linux

Simply type this:

usermod -a -G GROUP USER

or

gpasswd -a USER GROUP

Where USER is the user you want to add and GROUP is the group the user will now be a member. If you are currently logged in as USER, Login again for the new changes to take effect. Then, verify with:

id

It should look something like:

uid=10777(user) gid=16875(group1) groups=127(group2),16839(group3) context=...
No votes yet