Project

General

Profile

need help with authentication[solved]

Added by jason_f about 16 years ago

Hello. I've done extensive googling and am just not seeming to find information that relates to my situation.

I have fairly basic webserver, and I want to limit access to it with username/passwords. I want the entire site proteted.
A requirement is that users are able to change their own passwords.

I'm open to either building user accounts on the server diretly, and allowing them to change the passwords though SSH. or being able to change them through the webserver, whichever is easier.

But how to I go about setting up authentication in this case? Would appreciate if anyone can point me in the right direction.

thank you


Replies (3)

RE: need help with authentication - Added by nitrox about 16 years ago

auth.require = ( "/" =>
                               (
                                 "method"  => "basic",
                                 "realm"   => "Restricted Area!",
                                 "require" => "user=foo" 
                               )

lighty uses same format as e.g. apache, apache2-utils i think includes htpasswd...

auth.backend               = "htpasswd" 
auth.backend.htpasswd.userfile = "/etc/lighttpd/.htpasswd" 

allowing to change passwords is not that easy, but you can also auth against ldap/mysql and stuff like that. write your own small app which allows users to change their passwords there.

RE: need help with authentication - Added by jason_f about 16 years ago

Thank you for the quick response! This is just what I needed. I must be doing something wrong though because I'm not being prompted for a password, its just pulling up the site as if I hadn't changed anything.

I enabled mod_auth,
built the .htpasswd file and put a test user in it with the htpasswd command (using the -m switch for md5)

added:
auth.backend = "htpasswd"
auth.backend.htpasswd.userfile = "/etc/lighttpd/.htpasswd"

auth.require = ( "/" =>
(
"method" => "basic",
"realm" => "Restricted Area",
"require" => "valid-user"
)

Also tried replacing valid-user with user=name, with the test user account name, but that didnt change anything.

also enabled auth.debug = 2 in the config but I dont see any auth related output in access.log or errors.log...

did I miss something?

RE: need help with authentication - Added by jason_f about 16 years ago

Got it working, seems it was working all along. Browser cache looks to be the culprit. Worked fine from another computer, with autentication.

Thank you very much for your help, nitrox!!

    (1-3/3)