1. User Configuration Files
1.1 User Information file
(1) Introduction to User management
① the more server security requirements of servers, the more need to establish a reasonable level of user rights and server operating norms
② in Linux primarily through user profiles to view and modify user information
(2)/etc/passwd file (used to store user name and other information. Open with: #vim/etc/passwd, view Help: #man 5 passwd)
① 1th field: User name (e.g. root)
② 2nd field: Password flag,"x" means that the user has a password , stored in the /etc/shadow file (only management has permission to view). If you do not write "X", the system will assume that the user does not set a password, This user is allowed to log on only .
③ 3rd field: UID (User ID) A.0-superuser ; b.1-499: System User (pseudo-user);c.500-65535: Normal user
④ 4th field: GID (user initial group ID)
⑤ 5th field: User Description, from the comment function.
⑥ 6th field: Home directory
A. Normal User:/home/user name
B. Super User:/root/
⑦ 7th field: Shell after login
(3) Initial and additional groups
① Initial group : refers to the user immediately login to have the user group of the relevant permissions, each user can only and must have an initial group , by default, the creation of a user will create a group with the same name as the user name , As the initial group for this user.
② Additional groups: users can join multiple other groups of users and have permissions for those groups, and additional groups can have multiple.
1.2 Shadow File
(1)/etc/shadow file -- used to store user passwords and other information
① 1th field: User name:
② 2nd field: encrypted password (encrypted with SHA512), if the password bit is "!!" or "*" means no password and cannot log in. If you want to disable a user login, you can add "!" before the password bit.
③ 3rd field: the date the password was last modified. Use January 1, 1970 as standard Time, each day time stamp plus 1.
④ 4th field: Two-time password modification interval (compared to 3rd field)
⑤ password expiration (compared to the 3rd field)
⑥ 6th field: Number of warning days before password modification expires (compared to 5th field)
⑦ 7th field: The number of days after the password expires (compared to the 5th field). 0 fails immediately after the password expires. -1 means the password will never expire.
⑧ 8th field: Failure time. To be represented by a timestamp
⑨ 9th field: Reserved
(2) Time stamp conversion
① convert the timestamp to a date:
#date –d "1970-01-01 16066 Days"//Change the time stamp to 16,066-day period.
② Convert the date to a timestamp:
#echo $ (($ (Date--date= "2014/01/06" +%s))//Replace date 2014/01/06 with a timestamp, where +%s is converted to seconds, then/86400 to days.
1.3 Group information files and group password files
(1) Group information file:/etc/group
① 1th field: Group name (default for each additional 1 users adds 1 groups with the same group name as the user's initial group)
② 2nd field: Group password flag
③ 3rd field: Group ID (GID)
④ 4th field: Additional users in a group
(2) Group password file:/etc/gshadow
① 1th field: Group name
② 2nd field: group password
③ 3rd field: Group Admin user Name
④ 4th field: Additional users in a group
2. user Management related files
2.1 User's home directory
(1) Normal User:/home/user name/, the owner of this directory and the owning group are this user, the permissions are 700.
(2) Superuser:/root/, the owner and the owning group are root users, and the permissions are 550. If a normal user changes its UID to 0 to become superuser, the home directory is still/home/username/, but the user has superuser privileges.
2.2 Other Documents
(1) User email:/var/spool/mail/User name , This file will be created automatically when the user is created. For sending mail between Linux users, it is sent through memory (not the server on the network).
(2) User Template directory:/etc/skel/
① when creating a user, there will be additional default files in the user's home directory, which are copied from the/etc/skel/directory.
The files that are copied by default in the ② home directory are:. Bash_logout,. Bash_profile,. BASHRC, etc. (hidden files).
6th Chapter User and User group Management (1) _ User profile and other management related files