skip to Main Content

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…

enter image description here

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


  1. Just generate /etc/httpd/HTTP/.htpasswd file by command:

    # htpasswd /etc/httpd/HTTP/.htpasswd UserNameYouWant
    

    it asks you for password and generate password file with user UserNameYouWant

    Login or Signup to reply.
  2. Are you sure the file .htpasswd is there in /etc/httpd/HTTP/ directory. otherwise create 1 with the below command

    sudo htpasswd -c /etc/apache2/.htpasswd heather
    

    Here you go for step by step configuration:

    Login or Signup to reply.
  3. It’s probably a permissions issue if you think the file is in the right place.

    Check the file ownership and permissions with:

    ls -la /path/to/file
    

    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:

    ps -ef | grep apache
    

    You should see the owner of the process in the leftmost column.

    If file ownership is the issue, then use chown to change ownership:

    sudo chown username: /path/to/file
    

    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

    Login or Signup to reply.
  4. 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:

    chmod +x -R /home/username/.htpasswds
    
    Login or Signup to reply.
  5. If you’re using CentOS, then probably SELinux 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 :

    mv /path/to/.httpasswd /var/www/html/
    restorecon -v /var/www/html/.htpasswd
    
    Login or Signup to reply.
  6. I had the same problem on a Rackspeed server. It was because the file passwd was missing in /home/company/.htpasswds/project/

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search