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」參數用來刪除指定的使用者。