There is a restricted area in a site hosted by Apache HTTPD, which requires users to authenticate against the file /srv/www/security/site-passwd.
Which command is used to CHANGE the password of existing users, without losing data, when Basic authentication is being used?
A.
htpasswd -c /srv/www/security/site-passwd user
B.
htpasswd /srv/www/security/site-passwd user
C.
htpasswd -n /srv/www/security/site-passwd user
D.
htpasswd -D /srv/www/security/site-passwd user
题解
选项 A,「htpasswd」指令的「-c」参数会创建新的设置档,所以会将之前的设置覆盖掉。
选项 B,正确答案。
选项 C,「htpasswd」指令的「-n」参数会将结果输出到标准输出,而不是更新文件,所以无法修改密码档中的密码。
选项 D,「htpasswd」指令的「-D」参数用来删除指定的用户。
