Mobile app version of vmapp.org
Login or Join
Murray432

: Can I configure Apache's HTTP Authentication (.htpasswd) to require the name/password of a local user account? I'd like to restrict access to a certain directory in my webroot to all users that

@Murray432

Posted in: #Apache

I'd like to restrict access to a certain directory in my webroot to all users that belong to a specific group.

I know that I can create a .htpasswd file that specifies a user, or even several users, that should be accepted for HTTP Basic/Digest Authentication, but is it possible to have Apache accept any username/password from the local Linux machine's users?

To go a step further, is it possible (through .htpasswd or other means that anyone is aware of) to allow any valid user within a specific group?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Murray432

2 Comments

Sorted by latest first Latest Oldest Best

 

@Goswami781

There were a few similar questions on serverfault.com that searching didn't uncover:

serverfault.com/questions/45278/authenticate-in-apache-via-system-account https://stackoverflow.com/questions/8933406/svn-with-apache-authenticate-against-os-user-accounts


Basically, PAM and mod_auth_pam or mod_auth_external are potential ways to achieve this.

10% popularity Vote Up Vote Down


 

@Nimeshi995

is it possible to have Apache accept any username/password from the
local Linux machine's users?


For security reasons, this would be a very bad idea. Over the Internet, web traffic can be spied on by hackers, who would then have access to user login and password information for your server. Also, passwords on modern Linux systems are stored with encryption, which is meant to be only readable by the superuser. See this for more about that.

If you are by chance interested in providing secured access to Internet users, but unsecured access to users on your local network, then you could consider this. I would make sure however that this implemented over HTTPS using an SSL, instead of HTTP. And depending on how sensitive your data is, it might be wise to use separate servers for each set of users if possible.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme