Forum Moderators: mack

Message Too Old, No Replies

Password protecting a directory

         

GhostPig

10:52 am on Jul 8, 2004 (gmt 0)

10+ Year Member



Hello all,

I need to password protect a directory in my webspace, however, after messing around with .htaccess for sometime (and googling oh so much) I seem to have become stuck as I can't make the password file...

Is there any other way (besides .htaccess) to protect my directory?

Thanks!

mack

2:02 pm on Jul 8, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Hi there,

Are you running on an Apache web server, in order you use htaccess you need to be running Apache.

Tell us a nit more about your set-up. Do you have php, perl etc.

Mack.

GhostPig

7:22 am on Jul 9, 2004 (gmt 0)

10+ Year Member



I'm not sure what I have - I am running an Apache/1.3.26 Server though.

How would I check?

mack

12:40 pm on Jul 9, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



your best bet would be to ask your hosting company for advice. Lats face it no one "should" know their systems as well as them.

Apache generaly does support htaccess but hosts can alter their configuration to turn on off certain features.

There are quite a lot of free scripts written in php or perl that are designed for password protecting pages or site areas. These might well be worth looking into. You could try a search at hotscripts or other script resource sites.

Mack.

BlobFisk

1:51 pm on Jul 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can do this using some server side code. It's not as secure as doing authentication on the server, but if your information is not super sensitive then it may suffice.

The easiest way is to authenticate the users credentials on a login page and validate each page against the credentials stored in a session. The problem is that this needs to be done on each page.

This is one simple alternative - I'm sure that here'll be more!

HTH

jdMorgan

3:24 pm on Jul 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> I seem to have become stuck as I can't make the password file.

In order to create the password file for Apache basic authentication, you need to run a utility which resides on the server itself. Contact your host and ask them to give you the path to that utility, and then use telnet (or similar) to log in to the server and create or update the password file.

Ref: [httpd.apache.org...]

Jim

jatar_k

5:10 pm on Jul 9, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



there are scripted options in any scripting language but the .htaccess approach is by far the simplest.

encyclo

7:38 pm on Jul 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've used this simple free script to set up and manage simple password-protected directories before - it creates the .htaccess and .htpasswd files automatically. Might be what you're looking for:

[cgi-central.net...]