Page 1 of 1

Security

Posted: Wed Nov 27, 2002 2:44 pm
by oldtimer
I would like to password protect a folder. I am not sure where to ask this so I thought I would ask the fine people here. I use Debian running apache. I heard from someone that with the pear package you can do this. I dont use the htaaccess.

Posted: Wed Nov 27, 2002 3:21 pm
by BigE
Well... you can use PHP's User Auth thats built in, but that won't protect a whole directory, just the files you put it on. php.net/features.http-auth for more information on that. The only other way that I'm aware of is using .htaccess. Hope that helps.

Posted: Wed Nov 27, 2002 3:25 pm
by oldtimer
Yeah I pw protect pages right now but I want to do the whole directory as I want to protect more than just the pages.

How do you set up the htaccess? I have never understood that part either.

Posted: Wed Nov 27, 2002 3:50 pm
by BigE
Just setup a .htaccess file in the folder you want to protect that looks something like this

Code: Select all

AuthType Basic
AuthName "My Sites Secureness"
AuthUserFile /path/to/.htpasswd
Require valid-user
For the .htpasswd file, just use Apache's built in program to make .htpasswd files from the command prompt. If you want to learn more about it, search http://www.apache.org for more infomation on .htpasswd. The program used is infact called htpasswd so if you search for that, it should give you a couple of pages that should work fairly well. Hope that helps.

Posted: Wed Nov 27, 2002 7:10 pm
by oldtimer
Thank you. With your help and a little reading I now have the htaccess working.