#使用-c选项会重新生成选项指定的文件
[root@localhost conf]# htpasswd -c htpasswd.user aaa
New password:
Re-type new password:
Adding password for user aaa
[root@localhost conf]# cat htpasswd.user
aaa:Bb5sDJ18YXP..
[root@localhost conf]# htpasswd -cb htpasswd.user bbb bbb
Adding password for user bbb
[root@localhost conf]# cat htpasswd.user
bbb:jOmE6lLI7g45M
#添加用户推荐使用以下两种方式
[root@localhost conf]# htpasswd -n ccc >> htpasswd.user
New password:
Re-type new password:
[root@localhost conf]# cat htpasswd.user
bbb:jOmE6lLI7g45M
ccc:mAqD.htApgYNM
空行
[root@localhost conf]# htpasswd -nb ddd ddd >> htpasswd.user
[root@localhost conf]# cat htpasswd.user
bbb:jOmE6lLI7g45M
ccc:mAqD.htApgYNM
空行
ddd:uAb7o0aUwD5pg
空行
转载于:https://blog.51cto.com/sndapk/1295260