如何在命令行上创建 SHA-512 密码哈希

mkpasswd_example.sh
mkpasswd -m sha-512

要直接在命令行上传递密码(注意:密码将在 shell 历史中可见):

mkpasswd_pipe_example.sh
echo "mypassword" | mkpasswd -m sha-512 --stdin

如果你缺少 mkpasswd 命令,可以使用以下命令安装:

install_whois.sh
sudo apt install whois

示例输出

mkpasswd_output.txt
$6$hcGoahD4HKwRtkE8$m72NDqN0ePCRrUDorWS40Jl73sG0Rr2LVWHNAPh5MwHB2Lk1NTVIn8Lg7W.NK/rIkwqiJzttM9IJ.N5L74Gbn1

Check out similar posts by category: Linux