The Linux password file location is in /etc. The password file has all the information you need to know about a user such as his username, UID, GID, etc. There is one saying, if a beginner in Linux can create an entry in passwd file and create a user without using the useradd command, he can do anything he wants on a Linux box to carry out something. There are total seven fields in /etc/passwd file; These fields are separated by the delimiter “:” as described below.

surendra:x:1000:1000:Surendra home:/home/surendra:/bin/bash

1                   2     3            4                   5                                  6                           7

1) User login name: Shows what is the Login Id for a user.

2) Password: Specifies Where is your password located(in /etc/password file or /etc/shadow file)?

This field may contain any of the following info.

a) x, which show that the password for the corresponding user is in encrypted form and stored in /etc/shadow file

Related concept:   How to create multiple users in Linux

b) or an encrypted password, if shadow file is reverted.

3) UID: User identification number used by the system to know who the user is.

4) GID: Group ID is the number used by the system to identify the group where this user belongs primary group.

5) Comment: Used for giving some information about the account/user

6) User home directory: The home directory of the user where he logins.

7) Default shell: the shell for executing commands.

 

Some FAQ on password file


Q.How many users we can create in Linux?

In Ubuntu

2^32=4,294,967,296

In Redhat based machines

2^31=2,147,483,648

Note: We have tested on both the flavors

Note2: In Redhat based OS, this is 2^31 value due to signed integer.

Q.What is the UID and GID limit in Linux?

2^32= 4,294,967,296

Q. Why UID and GID is just limited to that number?

The linux kernel has officially had support for 32-bit uid numbers since kernel v2.4, so the maximum user id number is 4294967295, or about 4.3 billion in Ubuntu based and 2.1 Billion in Redhat based machines.

Related concept:   How to find RAM utilization by user in Linux

Q. Can two users in Linux have same UID?

Yes, just edit uid field in /etc/password to the required UID you want.

Q. How to see what are the shells available in a Linux Box?

#chsh –l will show all the shell available in the machine.

Q. What are the major files modified when you create a user?

The following files are modified when a user is created

/etc/passwd

/etc/shadow

/etc/group

/etc/gshadow

Please comment your thoughts/experience on this I will add some info based on your inputs. Stay tuned to my others post on other important user related files.