IT & IoT Security | Cloud | It's all about the life itself

Nothing in life is as important as you think it is, while you are thinking about it.

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.

Screen Shot 2016-05-22 at 18.37.43

Let’s scrutinize the meaning of fields at first.


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.

Screen Shot 2016-05-22 at 19.06.20

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.

Screen Shot 2016-05-22 at 18.55.17

/etc/group file stores group information like below.

Screen Shot 2016-05-22 at 19.02.31

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 🙂

3rd field > 1009 : Unique ID like user objects have.

4th field > billy,cibil,milly : Members of the group.

To make it short I’ll give a break.

I wish you have a nice day.

Leave comment

Your email address will not be published. Required fields are marked with *.