每行格式
login:passwd:lastchange date:minage:maxage:warning:inactivity:expiration date:reserved
密码结果
$N$salt$encryptedpassword
The N is a single digit which indicates the type of encryption used where
N=1 indicates MD5. This is easy to crack (not secure) and is very short.
N=5 indicates an SHA-256 password. This is much better (fewer passwords will produce the targeted encrypted password), and harder to crack.
N=6 indicates an SHA-512 password. Double the length of SHA-256, these passwords are very time-consuming to crack.
测试
#!/bin/bash
read -p "Enter username: " username
read -s -p "Enter password: " mypassword
echo
echo -n $username:$mypassword | chpasswd -S -c SHA512