Sometimes, you might have to create user groups for successful installation of certain software. Also, having different user groups, with different privileges is a great way to control user permissions for directories.
Log in to your system as the root
user:
localhost$ ssh root@<remote_ip>
Use the groupadd
command to add a new user group to your system:
# groupadd newgroup
Use the usermod
command to add an user to the group:
# usermod -aG newgroup existingUser
You can add an user to multiple groups:
# usermod -aG newgroup,group1,group2 existingUser
You can check which users are in a group using the grep
command:
# grep newgroup /etc/group
Or, you can do the same in a more elegant way, using the getent
command:
# getent group newgroup