Linux – User & Group Basics 1

Hey all,

I am going to review basic user group management tasks such as user creation, group creation, group membership changes, the files where user,group objects are stored. I have a CentOS7 basic installation. Before jumping into hands-on’s, it should be good to remind you about /etc/passwd and /etc/group files.

/etc/passwd file stores user informations created in your linux OS and a sample view of /etc/passwd file is shown below.

Let’s scrutinize the meaning of fields at first.

baris:x:1003:1008::/home/baris:/bin/bash

1st field > baris : This field represents the user logon name

2nd field > x : This one represents the encrypted password which is stored in /etc/shadow file.

3rd field > 1003 : A unique user identifier. (UID)

PS: UID 0(zero) is reserved for “root” , 1-99 are for pre-defined accounts , 100-999 are reserved by system for several purposes.

4th field > 1008 : ID of primary group that the user belongs to. The group information is stored in /etc/group file.

5th field > this field has not set yet: This is comment field that can be used for user’s full name etc. A sample view is shown below.

baris:x:1003:1008:Baris Aydogmusoglu:/home/baris:/bin/bash

6th field > /home/baris : The home directory of the user.

7th field > /bin/bash : User’s login shell. If this field is not set explicitly, the parameters which are defined in /etc/default/useradd file are used when creating user account.

/etc/group file stores group information like below.

Let’s scrutinize fields in the line “SaleTeam:x:1009:billy,cibil,milly”

1st field > SaleTeam : The name of the field.

2nd field > x : The password stored in /etc/gshadow file. I have not examine the usage of password on group objects. You can gain extra permission by entering the group password if it set. Google ftw 🙂