Input command: Head-n 4/etc/passwd
Output:
Root:x:0:0:root:/root:/bin/bash
Daemon:x:1:1:daemon:/usr/sbin:/bin/sh
Bin:x:2:2:bin:/bin:/bin/sh
Sys:x:3:3:sys:/dev:/bin/sh
To: Separate, the corresponding field meaning is as follows:
Username: Password: uid:gid: User description: Home directory: Login Shell
The passwords are all added and stored in the/etc/shadow file.
Head-n 4/etc/shadow | Sed 4a$ (tail-1/etc/shadow) #需要root权限, take the first 4 lines and the last line
root:$6$v3gjfoy7$okrvcsfnlqfiulebedzn.t9pvz0ngsv/6amfarnrzp8bkwdizyi1lb0fwqtb73/mo83z9jem2osjlx6eu3emr/ : 15847:0:99999:7:::
daemon:*:14728:0:99999:7:::
bin:*:14728:0:99999:7:::
sys:*:14728:0:99999:7::
rose:$6$tdmg2ppz$7a.qiv9dtozttomvlnqitmwegnldw1zjmqmadje5ixengsurty4q5uep8uvbazqfckolsscbrwg0/wkks15dq/ : 15848:0:7:7:15849:15851:
The meanings of each field are as follows:
Login Name: Encrypted password: Last modified: Password keep minimum time: password Expires: Days before password expires: Number of days expired: expiration Date: Account Expiration time-reserved field
1 "Login name" is a user account consistent with the login name in the/etc/passwd file
2 The "Password" field is stored in the encrypted user password Word, if empty, the corresponding user does not have a password, logon does not need a password; If you have characters that are not part of the collection {./0-9a-za-z}, the corresponding user cannot log on.
3 "Last modification Time" is expressed from a certain time to the number of days the user last modified the password. The beginning of time may not be the same for different systems. For example, in Scolinux, the starting point for this time is January 1, 1970.
4 "Password keep the shortest number of days": in these days must not need a password, if the 0 indicates that can be modified at any time.
5 "Password Expiration Days": From the date of the last modification of the password, after x days, the password expires, note that the expiration may not be able to log in, but also to see the seventh attribute judgment.
6 "Days before the password expires": You will be prompted to change your password x days before the password expires.
7 "After the expiration of the number of days" password expires on the day, in the X days can also log in, but the system will force you to modify the password, if 0, the password once expired directly invalid, can not log in again.
8 "Account Expiration Time" after this time, the account is disabled. Represented by the number of days from 1970-01-01 to the end date.
The specific meaning and the following list of modification commands:
|
|
Meaning |
|
Modify the command accordingly |
Note |
| 1 |
Login Name |
|
|
|
|
| 2 |
Encrypt password |
|
|
passwd |
|
| 3 |
Last modification time |
Last Password change |
--lastday |
Chage-d 2013-05-25 UserName |
You can also use the number of days from 1970-01-01 to indicate such as Chage-d 15845 userName |
| 4 |
Keep password for the shortest number of days |
Minimum number of days between password change |
--mindays |
Chage-m 2 |
|
| 5 |
Password Expiration days |
Maximum number of days between password change |
--maxdays |
Chage-m 10 |
|
| 6 |
Days of warning before password expiration |
Number of days of warning before password expires |
--warndays |
Chage-w 7 |
|
| 7 |
Number of grace days after expiration |
Set password inactive after expiration to inactive |
--inactive |
Chage-i 5 |
|
| 8 |
Account Expiration Time |
Account expires |
--expiredate |
CHAGE-E 2013-06-10 UserName |
You can also use the number of days from 1970-01-01 to indicate |
| 9 |
Reserved fields |
|
- |
- |
|
Chage-l can list expiration information for an account