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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deny access in linux

Status
Not open for further replies.

mosaur

IS-IT--Management
Oct 19, 2007
38
JO
Hi,
we have a web server on Linux Server (appache)
any one can access the web site via http and every thing is ok, but I want to deny access to every one except one Public IP address to one page on the server.
like so no one can access this link except one IP .
and I want to do it via linux firwall not programming method.
thanks.
 
I don't think it can be done from the firewall. You can limit access to the server to one ip but not a particular document or page. The best way is to put the page in its own sub-directory and create a container for it something like this:

Code:
<Directory "/path/to/private-dir/">
Order allow, deny
Allow from 192.168.1.20
</Directory>

This tells apache to only allow access to this directory or any page in this directory to the specified ip address. This can also be a network or subnet (192.168.1), a domain or even a particular webpage.


 
Firewall rule ip accept port 80 certain ip address? should be able to be done.

Do you have any kind of firewall?
 
sillyVM, I don't think your solution will work for a particular page. If I understood him correctly, that is what he is trying to do.

 
iptables and ipchains are highly functional firewalling solutions inside linux however if you're just trying to deny access to 1 specific page you might do better to move that page into it's own directory and use the example for htaccess above from RhythmAce instead. However if you're trying to firewall your entire webserver and all it's contents from the internet as a whole save the 1 IP address you might specify if you're using either iptables or ipchains locally or remotely so you can get an answer best suited for your setup.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top