LPIC-2 Exam 202 (Linux Engineer) — Question 23
There is a restricted area in a site hosted by Apache HTTPD, which requires users to authenticate against the file /srv/www/security/sitepasswd.
Which command is used to CHANGE the password of existing users, without losing data, when Basic authentication is being used?
Answer options
- A. htpasswd ""c /srv/www/security/sitepasswd user
- B. htpasswd /srv/www/security/sitepasswd user
- C. htpasswd ""n /srv/www/security/sitepasswd user
- D. htpasswd ""D /srv/www/security/sitepasswd user
Correct answer: A
Explanation
The correct answer is A because the '-c' flag is used to create a new password file but also allows changing the password for existing users without deleting the file. Options B and D do not specify the correct flags to change the password properly, while option C incorrectly uses the '-n' flag, which does not modify the password in the file.