![Htpasswd 命令不生成任何内容](https://linux22.com/image/1609015/Htpasswd%20%E5%91%BD%E4%BB%A4%E4%B8%8D%E7%94%9F%E6%88%90%E4%BB%BB%E4%BD%95%E5%86%85%E5%AE%B9.png)
这是我在此的头一篇博文!
我遇到了一个奇怪的问题:我想生成一个密码,但它什么都没有生成,我不知道为什么。
命令:
htpasswd –c a.htpasswd user
此命令的输出:
Usage:
htpasswd [-cimBdpsDv] [-C cost] passwordfile username
htpasswd -b[cmBdpsDv] [-C cost] passwordfile username password
htpasswd -n[imBdps] [-C cost] username
htpasswd -nb[mBdps] [-C cost] username password
-c Create a new file.
-n Don't update file; display results on stdout.
-b Use the password from the command line rather than prompting for it.
-i Read password from stdin without verification (for script usage).
-m Force MD5 encryption of the password (default).
-B Force bcrypt encryption of the password (very secure).
-C Set the computing time used for the bcrypt algorithm
(higher is more secure but slower, default: 5, valid: 4 to 31).
-d Force CRYPT encryption of the password (8 chars max, insecure).
-s Force SHA encryption of the password (insecure).
-p Do not encrypt the password (plaintext, insecure).
-D Delete the specified user.
-v Verify password for the specified user.
On other systems than Windows and NetWare the '-p' flag will probably not work.
The SHA algorithm does not use a salt and is less secure than the MD5 algorithm.
有人遇到过这种错误吗?
如何解决?
谢谢。
答案1
也许您是从其他文档或网络上复制的命令?因为您使用的是破折号,而不是连字符。
尝试复制这个:
htpasswd2 -c a.htpasswd user
或者使用键盘的连字符输入命令。