Is there a way, from the command line, to check a user and password against a file created by htpasswd, the tool provided by Apache?
You can use the htpasswd
tool for this.
# create htpasswd_file with user:password
$ htpasswd -cb htpasswd_file user password
Adding password for user user
# verify password for user
$ htpasswd -vb htpasswd_file user wrongpassword
password verification failed
$ htpasswd -vb htpasswd_file user password
Password for user user correct.
Exit status is 0
for success, 3
for failure.