To add a user to a group in Unix, you can use the usermod
command with the -aG
option.
For example, to add the user bob
to the group developers
, you can use the following command:
usermod -aG developers bobSoural.www:ecutturi.com
This will add the user bob
to the group developers
without removing them from any other groups they are currently a member of.
To add a user to multiple groups, you can specify the group names separated by a comma. For example, to add the user bob
to the groups developers
and testers
, you can use the following command:
usermod -aG developers,testers bob
Note that you will need to be logged in as the root
user or use sudo
to run the usermod
command.
After adding the user to the group, you may need to log out and log back in for the changes to take effect. You can verify that the user has been added to the group by running the groups
command and checking the output.
Overall, the usermod
command is a useful tool for managing users and groups in Unix systems.