Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
In windows we have a file called HOST(%windows%drivers/etc), we can block/redirect sites to desire location, Can I do same thing in my Fedora 10?
Thanks
Prashant Saraf
Hi and Welcome to LQ!
Secondly, in short answer to your question: Yes.
Thirdly, it can be done in any Linux system (not only Fedora) using different approaches. It's not a Windows feature BTW. If you see you notice that /etc part in the file path of the Windows system tries to emulate the Unix file system hierarchies.
Anyway you can do what you desire. There is a /etc/hosts file where you can do what you did in the Windows system.
Another way of doing that is by using the TCP Wrappers system. This is how you do it. You can use hosts.allow and hosts.deny file in /etc to allow or deny connections. See 'man 5 hosts_options' and 'man 5 hosts_access'for more information on rule syntax.
There are other techniques too, but I guess these might be sufficient and simple.
In windows we have a file called HOST(%windows%drivers/etc), we can block/redirect sites to desire location, Can I do same thing in my Fedora 10?
Thanks
Prashant Saraf
You can block it that way (/etc/hosts), however a better way would be to use iptables.
a simple way to block traffic to and from would be:
iptables -A INPUT -s sitetoblock.com -j DROP
iptables -A OUTPUT -d sitetoblock.com -j DROP
Although if you only want to block going to the site the second will do it alone. Having it in conjunction with the first makes it a bit stronger however.
The file /etc/hosts.deny is specifically meant to contain the list of IP's that are not allowed to access the server at all. There is also an /etc/hosts.allow file with the obvious opposite function.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.