Forum Moderators: phranque

Message Too Old, No Replies

Password Protect file/directory

         

topr8

10:19 am on Mar 26, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



i'd like to password protect a file (or a folder which i could then put the file in)

i'm assuming i can do this directly in my httpd.conf file, which is what i'd liek to do but i can't seem to find the syntax, examples i find everywhere are for .htaccess

any ideas?

jdMorgan

2:31 pm on Mar 26, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Password-protection on Apache is per-directory.

mod_access syntax should be identical for either context.

Typically, though, you'd enclose the mod_access code in httpd.conf inside a <Directory> container.

See Apache mod_access Order, Allow, and Deny, directives and Apache core <Directory> and Satisfy directives.

Jim

topr8

9:13 pm on Mar 26, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



thanks for that.

for future reference, here's what i did, which worked for me:

<Directory "path/to/my/restricted/directory">
require user actual-allowed-user-name
AuthName "Restricted Directory"
AuthUserFile /path/to/my/password/file
AuthType Basic
allow from all
order deny,allow
</Directory>