User-managed 2 Important files:/etc/passwd and /etc/shadow.
The/etc/passwd file contains the user's information, which does not contain a password:each line in the passwd file represents a user, and each line is divided into 7 fields using ":" as delimited.
Use the cat command to view the contents of a passwd file
Take the first line: ROOT:X:0:0:ROOT:/ROOT:/BIN/BASHW as an example
7 fields represent the meanings of each:
1. Account name, which corresponds to the UID.
2. Password: Use x instead, the real password is placed in the/etc/shadow file.
3. The UID is the user identifier.
The UID limits are as follows:
Id Range |
Description |
0 |
The UID of 0 is the system administrator. So a system administrator can have multiple, but not recommended, multiple system administrators. |
1~499 |
SYSTEM account, reserved for system use account id . Please do not confuse with the ordinary user that we create, the function of the SYSTEM account is: Start some service to use on the system. The system account replaces the root Super Privilege account, that is, the system account permissions are very small, just maintain some service start permissions. SYSTEM account is divided into 2 : 1~99 : By distributions created account. 100~499 : The uid is required for the system account in our own use. |
500~42949627295(2 of the three-party minus 1) |
The UIDused for the general user. |
4. GID uses the corresponding user group ID, the corresponding file is /etc/group only used to identify the user group.
5. The User Information Description column, the use is not very useful, only explains the function.
6. Home folder, the user's home folder, the folder location where the user first arrives after landing. root Default /root, other ordinary users are under the/home/username folder.
7. Shell, a shell file obtained after the user logged in to communicate with the system kernel to perform the user's operation. You can also use /sbin/nologin instead of the user cannot get the shell file, mainly used to make pop mailbox.
。
/etc/shadow file: The user's password information is stored, the password is encrypted. a total of 9 fields.
Take the root user as an example:
Root:$6$v/e4l9obq1axy7i1$evo6ww2lvlrlb3atogffdojd/a2pffmozsfsweoq87xoeopklea28m.pjdct4ylkdrpy/u0dxikkjhlhnvqnj .: 17309:0:99999:7:::
1. Account Name
2. Password, password is encrypted.
3. Date the password was recently changed. The date is a number, calculated as starting from 1970 January 1st, 1 represents 1 days meaning.
4. The number of days the password cannot be changed.
5. The number of days the password needs to be updated.
6. The prompt number of days before the password needs to be updated.
7. Grace time after the password expires.
8. Expiration date of the account.
9. Reserved words.
2 Important Files related to user groups:/etc/group,/etc/gshadow
View /etc/group
4 fields:
1. Name of the user group.
2. Password for the user group. is usually not set. Because the true password is in the /etc/gshadow file, it is all "X".
3. GID, ID of the user group .
4. User group contains users, use, separate.
Discusses the effective user groups (effective group) and (initial group) initial user groups
What is a valid user group that, in fact, is the user group or system that we specified when we created the user, to the default user group, and to view the user groups for the GID in the fourth field in/etc/passwd . is called a valid user group.
What is the initial user group, when we landed, theLinux system went to see the GID of the fourth field in our/etc/passwd file , and obtained the permissions that changed the GID. is called the initial user group.
Other user groups, because one user may have more than one user group, and the rest is the other user group.
To view the commands for which user groups the current user exists:groups
The valid user group for the Guoyanan account is Guoyanan and the other is root.
User group password /etc/gshadow file contents:
a total of 4 fields:
1. User group name.
2. Password column, if the beginning is ! Indicates that the password is invalid.
3. User group Administrator's account number.
4. The user group's account number.
What is a user group administrator: When the account is too many,root is not busy, give a user group to specify a management account. Let this account manage the users under their own user group.
Important files for Linux user management and user groups