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.
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
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 Redhat based machines
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?
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.
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
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.
Latest posts by Surendra Anne (see all)
- Review: Whizlabs Practice Tests for AWS Certified Solutions Architect Professional (CSAP) - August 27, 2018
- How to use ohai/chef-shell to get node attributes - July 19, 2018
- wget download a file to a directory in Linux/Unix - June 4, 2018
- GIT: How to compare two GIT branches? - June 3, 2018
- Online training on Linux Bash shell scripting - February 8, 2018