Could not open passwd file -c for reading
When you were trying to use htdigest instead of htpasswd to create a password file, you might meet the error:
[root@test ~]# htdigest -c /usr/local/httpd/passwords steven
Could not open passwd file -c for reading.
Use -c option to create new one.
Actually, the error message was not accurate, it could mislead you to the wrong way to solve the problem.
Let's see the synopsis of the command.
Please notice that, there is a required parameter called: "realm" must be included in command line. That's the difference between htdigest and htpasswd. Let's create the file again.
[root@test ~]# htdigest -c /usr/local/httpd/passwords private_zone steven
Adding password for steven in realm private_zone.
Re-type new password:
Yes, we succeeded to create a password file. Let's see the file.
[root@test ~]# ls -l /usr/local/httpd/passwords
-rw-r--r--. 1 root root 52 Oct 15 19:42 /usr/local/httpd/passwords
[root@test ~]# cat /usr/local/httpd/passwords
The problem is sovled.