20 quick tips to make Linux networking easier (2/20)
已有 316 次阅读2020-2-19 10:58
|系统分类:Linux
2: Keep out unwanted users with /etc/hosts.deny
Yet another helpful “hosts” file is hosts.deny. This file allows you to create access control based on client or
server names. This is helpful in many ways. You can block blacklist domains from gaining access to your
network or you can block certain users from gaining access to certain machines. But no matter how you use
it, the format is the same.
Let’s say you want to block the domain bad.domain.name from gaining access to a machine. To do this, open
up the /etc/hosts.deny file (you will need either root or sudo privileges) and add this to the bottom of the file:
ALL: bad.domain.name
Save it and you’re good to go.