Linux Add User To Group Using Command-Line

www.l‮.iruttua‬com
Linux Add User To Group Using Command-Line

To add a user to a group on a Linux system using the command line, you can use the usermod command.

To add the user user1 to the group group1, run the following command:

sudo usermod -a -G group1 user1

This will append the user user1 to the group1 group. The -a option tells usermod to append the user to the group, rather than replacing the user's existing group membership.

You can also use the adduser command to add a user to a group. To add the user user1 to the group group1 using adduser, run the following command:

sudo adduser user1 group1

Note that you will need to log out and log back in for the changes to take effect.

Created Time:2017-10-29 22:08:51  Author:lautturi