First,/etc/passwd
The/etc/passwd file is a plain text file with the same format for each line:
Name:password:uid:gid:comment:home:shell
Name User Login Name
Password user password. Passwords in this domain are encrypted and commonly represented by X. When the user logs on to the system, the system takes the same algorithm for the input password and compares it to the content in this domain. If this field is empty, it indicates that the user does not require a password when logging on.
UID Specifies the UID of the user. When a user logs in to the system, the system uses this value instead of the user name to identify the user.
GID GID. This value is used if the system wants to assign the same rights to the same group of people.
Comment is used to save the user's real name and personal details, or the full name.
Home Specifies the absolute path of the user's home directory.
Shell if the user is logged on successfully, the absolute path of the command to be executed is placed in this area. It can be any command.
If the/etc/passwd file holds the user's information, the 7 messages consisting of 6 semicolons are explained as follows
(1): User name.
(2): password (already encrypted)
(3): UID (User ID), operating system's own
(4): GID group identification.
(5): User's full name or local account
(6): Start directory
(7): The shell used for login is the tool to parse the login command.
Example: Abc:x:501:501::/home/abc:/bin/bash
Second,/etc/shadow
If you view the/etc/shadow file, the following special account information is stored:
name:!! : 13675:0:99999:7:::
Each line defines the password information for a special account, separated by: each field.
Field 1 defines the special user account associated with this shadow entry.
Field 2 contains an encrypted password.
Field 3 number of days since 1/1/1970 the password has been modified
Field 4 The number of days before the password will be allowed to be modified (0 means "can be modified at any time")
Field 5 The number of days before the system will force the user to modify to a new password (1 means "never modify")
The number of days that the user will be warned of expiration before field 6 password expires (-1 means "no warning")
Field 7 The number of days that the system automatically disables the account after the password expires (-1 means "never disabled")
Field 8 The number of days that the account is disabled (-1 means "This account is enabled")
Field 9 reserved for future use
If you view the general account information stored under/etc/shadow as follows:
(1): Account name
(2): Password: Here is encrypted, but the master can also be decrypted. To major security issues (generation!) Symbol identifies the account cannot be used to log in)
(3): Date of last password change
(4): Number of days for which the password cannot be changed
(5): Number of days the password needs to be re-changed (99999 means no change required)
(6): A few days prior to the password change warning
(7): Account Expiration date
(8): Account Cancellation Date
(9): Keep the entry, not currently useless
Example: abc:!! : 14768:0:99999:7:::
This article is from the "focus on Java,linux Technology" blog, please be sure to keep this source http://wuqinglong.blog.51cto.com/9087037/1652442
Details of passwd and shadow files under Linux