1

The question might seem trivial but for the last 36 months I have lived in the illusion that what I put in the hosts.deny file will stop my computer from visiting those sits. But some sites have still been coming through and establishing connections.

But last week I threw in my whole hosts.deny list into the hosts file and now everything that I wanted to block is blocked.

Why have a hosts.deny if having it in the hosts file does the trick?

What I mean by blocking is

127.0.0.1 somesite.topdomain

I asked a similar question a year or so ago, but by then I had not tried putting everything in the hosts-file and no one seemed to connect the dots.

1 Answer 1

3

They're used by different tools. See man hosts;man tcpd.

/etc/hosts.deny is part of the TCP Wrappers package tcpd (see Wikipedia), and acts as an intermediary between an inetd-like daemon, and the target TCP service, and is used as an access control mechanism for Incoming TCP connections.

/etc/hosts is part of how your system looks up URIs and translates hostnames to IP addresses, and is used for Outgoing TCP/IP requests.

1
  • Thank you. That made it clear. Perhaps that information should be a comment at the beginning of the hosts.deny file or hosts file.
    – no mouse
    Jul 22, 2016 at 10:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .