Linux – Users and Groups – Part 2

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.

users_groups1

Create a new group called “oinstall” with group ID 5001 and add the oracle user to it #usermod -aG <group> <user>. 

users_groups11

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.

users_groups14.JPG

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s