Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How do I force someone to login for a webpage?

Specifically, I have a linux server, where everyone has a login to that server. Can I make users login to the webpage with that login info?

If I can't use that apporach, what are my other options?

share|improve this question

4 Answers 4

up vote 5 down vote accepted

Assuming you're running Apache, you may want to use an htaccess file. Apache also has built in access controls that you can use.

share|improve this answer

If you want people to be able to login using their server login credentials then take a look at http://code.google.com/p/mod-auth-external/

As other people have mentioned there is also mod_auth_pam but that isn't developed any more but might work for you. As ever YMMV :)

share|improve this answer

If you want to build it into your website, you can build in session management and protect the content that you want.

If you want to give them file access, you may want to look at samba instead.

Just to be sure, are you trying to get people to login to the server and access the server's resources (file shares, etc) by only logging into a webpage and not into the server it self?

Good luck

share|improve this answer

Assuming you are using apache, then you could use the mod_auth_pam module to use the local system for authentication.

At least on Debian/Ubuntu you would need to add the www-data to the shadow group (/usr/sbin/adduser www-data shadow).

You would also need to add a section to your apache configuration like this.

<Location />
    # libapache2-mod-auth-pam is required
    AuthBasicAuthoritative Off
    AuthPAM_Enabled on
    AuthUserFile /dev/null
    AuthType Basic
    AuthName "PAM"
    Require valid-user
    Order Deny,Allow
    Deny from all
    Satisfy Any
</Location>

You should also strongly consider setting up SSL so your system passwords will not be stolen by someone with a sniffer.

share|improve this answer

Your Answer

 
discard

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.