PDA

View Full Version : .htaccess deny a single user?


Bruce Kennedy
01-23-2000, 01:32 PM
I would like to use the .htaccess file to deny a single person from entering my site. I know the IP name and I know the IP number. Have any of you done this? What format did you use.

I would appreciate it if the administrator would delete my "n" thread below. Sorrry for the problem.

Thank you for your help.

Charles Capps
01-23-2000, 03:51 PM
<Limit GET PUT POST>
order allow,deny
allow from all
deny from 123.231.132.
</Limit>

Just replace the mock IP with the IP of the person to be banned.[nbsp][nbsp]If it's a dynamic IP, chop off the last bit...[nbsp][nbsp]

Bruce Kennedy
01-23-2000, 08:46 PM
Charles, I appreciate your help. I can deny myself by placing the .htaccess under my www directory, however, if I it will not deny entry into a cgi-bin program. So, I moved it up one level and got the &quot;internal server error&quot; rather than the &quot;Forbidin&quot; message I received at the www level.
Any ideas as to what can be done to make it work in the cgi-bin? Thank you for your help.

sheila
01-23-2000, 09:01 PM
If you want to forbid access to both your www directory and your cgi-bin directory, you have to put the same .htaccess file in each directory. I found out the hard way I had to do this in order to deny public access to my web discussion board.

Bruce Kennedy
01-23-2000, 09:46 PM
Hi Sheila, I tried what you suggested and it still doesn't work. I can get it to work under the www directory, but not the cgi-bin directory or the ubb directory. Any ideas? What format did you use to get both to work? Thank your for your help.

sheila
01-23-2000, 10:24 PM
Well, actually, I have another folder inside my cgi-bin where I put the files for one of my cgi-scripts. It is only this script that I wanted to restrict access to, so I put the .htaccess in that folder only.
Then I also put the same .htaccess file in the web directory (not my www directory, but a subdirectory) that I wanted to restrict access to.

I have not banned a user, so my .htaccess file doesn't look like what you want. I have instead created a file of user names. My file looks something like this:

AuthUserFile /big/dom/xmydomain/foldername/filename
AuthName &quot;Restricted Access&quot;
AuthType Basic
require valid-user

The way this works, you have to create a filename where you store the valid user IDs and their corresponding passwords. This isn't what you're doing, so I don't know how helpful this is for you.

Vroomfondel
01-24-2000, 04:00 PM
Just be careful with such things. You can block IP addresses easily, but in most cases you need to block the entire series, not a single IP. So blocking 132.132.132.132 isn't going to help if the person is on a dial-up account and is using IP 132.132.132.250 or 132.132.132.1 tomorrow. To be sure to block out the one trouble-maker you need to block 132.132.132.*[nbsp][nbsp][nbsp][nbsp]and that also blocks out everyone else that uses that set of IP addresses.[nbsp][nbsp]If you wind up blocking out a popular widely used service you could cost yourself a lot of traffic to get rid of a single person.

ubu
03-11-2003, 04:54 PM
Can you use the same method here to block a domain? So instead of an IP address, can you block DomainA.net instead?

Thanks!
Jamie

Rich
03-11-2003, 06:15 PM
So, I moved it up one level and got the "internal server error" rather than the "Forbidin" message I received at the www level.
Doesn't this achieve your objective?