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.
htdigest [ -c ] passwdfile realm username
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.
New password:
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
steven:private_zone:411979d402fec64b6379c48d40e8a773
The problem is solved.