Part 1 of Linux Users and Groups is here: Linux – Users and Groups – Part 1 where we discussed User accounts. Moving on to Part 2 lets talk about Groups.
In Part 1 we have seen creating group and creating user in that group. We could see that from “/etc/passwd” that oracle user id is 1521 and primary group dba group id is 5000. When you become “oracle” user #su – oracle and run $id shows the groups that user belongs to.
Couple of things we should note that 1) groups are placed into /etc/group file 2) Even though oracle user belongs to dba as primary group doesn’t show up in the /etc/group.
Create a new group called “oinstall” with group ID 5001 and add the oracle user to it #usermod -aG <group> <user>.
This time we check /etc/group – we could see oracle user in oinstall group list. Also concludes that we need to check /etc/passwd for user’s primary groups and /etc/groups for additional groups.
Removing the user from additional groups that we have added. #gpasswd -d <user> <group> will delete the user from the group.