密码管理命令passwd
1. 语法:passwd [options] [USERNAME]
2. --stdin //从标准输入获取用户密码;例:echo "redhat"|passwd --stdin user1
3. -l //锁定用户
4. -u //解锁用户
5. -d //删除用户密码
6. -n mindays //指定最短使用期限
7. -x maxdays //指定最长使用期限
8. -w warndays //提前多少天开始警告
9. -i inactivedays //非活动期限,密码过期后到禁用前的这段时间
密码生成工具openssl
1. //语法:openssl command [command_opts] [command_args]
2. command //包含标准命令、消息摘要命令、加密命令
3. version //查看程序版本号
4. dgst //提取特征码
5. passwd //生成密码
6. rand //生成伪随机数
8. //提取特征码
9. [root@localhost~]# openssl dgst -md5 /etc/fstab
10. MD5(/etc/fstab)=1e5e9207c47ba4e9393b153dc3b0375a
12. //生成密码 openssl passwd -1 -salt 'string'
13. [root@localhost~]# echo "hzz" | openssl passwd -1 -salt hellonihao -stdin
14. $1$hellonih$hSAyL4yP5lbKiUh76Z6W30
16. //生成随机数 openssl rand -base64 NUM ; NUM表示随机数的长度
17. [root@localhost~]# openssl rand -base64 20
18. aVQYKyrx8pX3y4Vjb8QBtxMbY9k=