We have Plesk site builder through our webhosting with Charter. Using it to create a simple development website.
I am trying to password protect the site using .htaccess / .htpasswd.
I keep getting this error no matter what I do:
[Wed Apr 06 09:02:57 2016] [error] [client 66.169.84.65] (2)No such file or directory: Could not open password file: /.htpasswd
[Wed Apr 06 09:02:57 2016] [error] [client 66.169.84.65] access to / failed, reason: verification of user id 'heather' not configured
[Wed Apr 06 09:03:52 2016] [error] [client 66.169.84.65] (2)No such file or directory: Could not open password file: /etc/httpd/.htpasswd
[Wed Apr 06 09:03:52 2016] [error] [client 66.169.84.65] access to / failed, reason: verification of user id 'admin' not configured
[Wed Apr 06 09:03:56 2016] [error] [client 66.169.84.65] (2)No such file or directory: Could not open password file: /etc/httpd/.htpasswd
[Wed Apr 06 09:03:56 2016] [error] [client 66.169.84.65] access to / failed, reason: verification of user id 'heather' not configured
[Wed Apr 06 09:05:11 2016] [error] [client 66.169.84.65] (2)No such file or directory: Could not open password file: /etc/httpd/HTTP/.htpasswd
[Wed Apr 06 09:05:11 2016] [error] [client 66.169.84.65] access to / failed, reason: verification of user id 'admin' not configured
[Wed Apr 06 09:05:15 2016] [error] [client 66.169.84.65] (2)No such file or directory: Could not open password file: /etc/httpd/HTTP/.htpasswd
[Wed Apr 06 09:05:15 2016] [error] [client 66.169.84.65] access to / failed, reason: verification of user id 'heather' not configured
I’m not very familiar with Parallels Plesk – and getting a hold of their support is like pulling teeth.
- I’ve checked and double checked the path to the .htpasswd file; seems right.
- I’ve moved it and the .htaccess file to see if I just
don’t have it in the right place
I’m not sure what the problem is. I get the authentication box (I notice it doesn’t have my “Please Login” message though…
here is the code for the .htaccess file:
#
# AUTHENTICATION
#
### BASIC PASSWORD PROTECTION
AuthUserFile /etc/httpd/HTTP/.htpasswd
AuthName "Please Login"
AuthType basic
<Limit GET POST>
Require valid-user
</Limit>
ANY Help is greatly appreciated or leads in the right direction. THANKS IN ADVANCE!!
6
Answers
Just generate /etc/httpd/HTTP/.htpasswd file by command:
it asks you for password and generate password file with user UserNameYouWant
Are you sure the file .htpasswd is there in /etc/httpd/HTTP/ directory. otherwise create 1 with the below command
Here you go for step by step configuration:
It’s probably a permissions issue if you think the file is in the right place.
Check the file ownership and permissions with:
Make sure the file/group that your apache process runs as is able to read the file.
You can check the owner of the process by running:
You should see the owner of the process in the leftmost column.
If file ownership is the issue, then use chown to change ownership:
You need to do this as root/sudo as non-root users don’t have the right to change the ownership normally.
The : after the username changes the group over to the same as the username
I ran into the same problem. For me,
.htpasswd
was stored under the/home/username/.htpasswds
directory. I solved the error by recursively making sure the directory is executable:If you’re using
CentOS
, then probablySELinux
is blocking access to that file if the file is outside the webserver root directory. (that’s what happened to me).Solution
Move the file to your web server root directory then restore the file
SELinux
context using these commands :I had the same problem on a Rackspeed server. It was because the file
passwd
was missing in/home/company/.htpasswds/project/