Add User to Linux Group: Quick Command Guide
To add a user to a user group, you can use the following command:
- Create a new user group: sudo groupadd groupname
- Add a user to an existing user group: sudo usermod -a -G groupname username
Please note that in the above command, “groupname” refers to the name of the user group, and “username” is the name to be added to the user group.
For example, to add the user “john” to the user group “developers”, you can execute the following command:
sudo groupadd developers
sudo usermod -a -G developers john
Please make sure to have the appropriate permissions when performing these operations, you can use the sudo command to obtain administrator privileges.