User authorization does not work on a website page

Created:

2017-08-11 16:59:00 UTC

Modified:

2017-08-11 17:19:03 UTC

0

Was this article helpful?


Have more questions?

Submit a request

User authorization does not work on a website page

Symptoms

1. User authorization does not work on a website.

2. There is no password-protected directory configured in Plesk at Domains > example.com > Password-Protected Directories.

3. Password-protection is configured using .htaccess file and a path to .htpasswd is specified in the following way:

# cat /var/www/vhosts/example.com/httpdocs/.htaccess
..
AuthUserFile /var/www/vhosts/example.com/httpdocs/cgi-bin/password/.htpasswd

4. The .htpasswd has proper permission for Apache to read it (644):

# ls -la /var/www/vhosts/example.com/httpdocs/cgi-bin/password/.htpasswd
-rw-r--r-- 1 username psacln 5518 Aug  5 06:30 /var/www/vhosts/example.com/httpdocs/cgi-bin/password/.htpasswd

5. Trying to login to the website, the following error is logged to domain's apache error log:

# tail -fn0 /var/www/vhosts/system/example.com/logs/error_log
[Fri Aug 11 10:02:03.884271 2017] [auth_basic:error] [pid 21557:tid 139702216660736] [client 203.0.113.2:51026] AH01617: user username: authentication failure for "/": Password Mismatch

Cause

Apache cannot parse .htpasswd file.

Resolution

Use proper encryption method for passwords.

1. Log in to the server via SSH.

2. Update passwords with the command like below:

# htpasswd /var/www/vhosts/example.com/httpdocs/cgi-bin/password/.htpasswd username 

where username - a login of the user that should be able to login to the website

Additional information

Password Formats Apache - HTTP Server Version 2.4

Have more questions? Submit a request
Please sign in to leave a comment.