How to Add a User to a Group in Linux
Existing User to a Secondary Group
To add an existing user to a secondary group, use the following command:
usermod -a -G groupname username
Example:
usermod -a -G editors john
Creating a User While Adding it to a Group
You can create a user and add it to a group simultaneously using the useradd command:
useradd -G groupname username
Example:
useradd -G editors jane
Komentar