Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to use the system passwd file for accessing a protected web page with Apache on Linux? Setting up multiple password files for shell access, Apache and Samba is a pain. If there is a mod for that, it would be handy to know.

share|improve this question
up vote 3 down vote accepted

mod_auth_external ( can be configured to auth against /etc/shadow

share|improve this answer
This is made of WIN. You're running another daemon as root, but it should be simple enough to be sure there's no security problems with it. – David Pashley Aug 14 '09 at 5:53


mod_auth_pam is the standard method on most UNIX systems and apache.


Configure PAM

Here’s what the /etc/pam.d/httpd looks like (could be different on your distro)

auth required
auth required
account required

Configure Apache

AuthPAM_Enabled on
AllowOverride None
AuthName "secure area"
AuthType "basic"
share|improve this answer
How does this work without putting www-data in the shadow group? – David Pashley Aug 14 '09 at 5:50
Oh, it doesn't. FAIL. – David Pashley Aug 14 '09 at 5:51

Here's a link to a module that works with mod_perl to do exactly what you're asking: Apache-AuthenPasswd-0.12

share|improve this answer

Is it possible---yes. However, I'm not sure that this is a really good idea from a security standpoint. I thought that there is a lot of information out there saying not to directly link the system passwd information as an authentication source.

Another possibility (with a lot of effort and planning) is to implement LDAP.

share|improve this answer
I would still like to know how to implement LDAP. It seems more difficult than it should be. – casualcoder Feb 18 '12 at 23:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.