Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Net Help Getting Started - .htaccess

Status
Not open for further replies.

mtorbin

Technical User
Nov 5, 2002
369
US
Hey all,

I haven't done this in quite some time so I'm VERY rusty. I appreciate the understanding.

I am trying to create an .htaccess file that will simply prompt me for a password. This is what I have so far:

AuthUserfile /var/www/html/[myFolderName]/.htpasswd
AuthGroupFile /dev/null
AuthName "[myFolderName]"
AuthType Basic

<Limit GET>
satisfy any
order deny,allow
deny from all
require user mtorbin
</Limit>

Should this not just simply prompt me for the password I set up in .htpasswd? Unfortunately, it isn't doing that. Now I haven't touched my httpd.conf file yet but that shouldn't matter, right? This is just simple Apache 101. Please advise.

- MT
 
There's different ways of doing it, but here's what I've got:

In .htaccess:
AuthUserFile /etc/.htpasswd
AuthGroupFile /dev/null
AuthName &quot;Any old message you want to appear on the popup&quot;
AuthType Basic

require user MyUser

In httpd.conf:
<Directory &quot;/directory/stem/where/.htaccess/files/might/exist&quot;>
Options none
AllowOverride AuthConfig
</Directory>

The above directory doesn't need the be the specific one, it could be a higher level and then .htaccess in an of the subs will control it.
 
Thanks! That did the trick. Now I just have to play with it and configure it. I think the part that I was missing was the second half (the &quot;in httpd.conf&quot; part) which was confusing me.

Odd question:

I know this exists but I can't seem to find it. Is there a way to delete a filve at the unix command prompt? More specifically, I want to go in and delete .htpasswd and then create a new one. The only other way I know to do this is to &quot;pico&quot; into the file and clean it out myself, but I don't think that's the best way of accomplishing this task. Any suggestions?
 
Let me step back a second because I think I typed too quickly. I have the popUp box showing up but for some reason, I cannot get it to read my password. I'm currently working on that now and I'll let you know what happens if I fix it. I've even tried it in the default ASCII password format and it doesn't seem to want to recognize the password. Any ideas?
 
So this is the error message that I'm getting:

[Mon Dec 01 09:13:37 2003] [error] [client ipAddress] (2)No such file or directory: Could not open password file: /[myDirectoryPath]/.htpasswd, referer: http://[ipAddress]/
[Mon Dec 01 09:13:37 2003] [error] [client ipAddress] user mtorbin not found: /[myDirectoryPath]/index.html, referer: http://[ipAddress]/

What should I conclude from this:

1) My chmod is incorrect for .htpasswd?
2) My directory path is wrong?

Please advise.

- MT
 
I just solved the problem! Phew! This is what I did. I simply changed the CHMOD so that it mirrored that of .htaccess. As soon as the browser could read it, BINGO!

Thanks all!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top