Apache user does not meet require-ments for user/valid-user

If you’re trying to setup a basic password protection for your web server, you may have started from the official Apache documentation configuration:

AuthType Basic
AuthName "Restricted Files"
# (Following line optional)
AuthBasicProvider file
AuthUserFile /usr/local/apache/passwd/passwords
Require user rbowen 

I did in fact start from that and after creating a user with:

# htpasswd -c /etc/apache2/users.wiki velenux
New password: 
Re-type new password: 
Adding password for user velenux

Since I wanted more than one user to be able to access the page, I modified the configuration to:

    AuthType Basic
    AuthName "Accesso privato"
    AuthBasicProvider file
    AuthUserFile /etc/apache2/users.wiki
    Require user valid-user

After restarting Apache and testing the access, I got this error in the Apache log files:

[Thu Feb 20 16:28:58 2014] [error] [client 10.x.x.x] access to /path/page.html failed, reason: user 'velenux' does not meet 'require'ments for user/valid-user to be allowed access

The problem was that I changed from Require user SPECIFIC_USER to Require user valid-user, the correct form is Require valid-user, so the correct configuration is:

    AuthType Basic
    AuthName "Accesso privato"
    AuthBasicProvider file
    AuthUserFile /etc/apache2/users.wiki
    Require valid-user

It took only a few minutes to solve it, but since I didn’t find a quick answer to this, I decided to write it down for future reference. I hope it helps!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s