我想让一堆网站在我的电脑上无法访问。
我的hosts.allow文件:
sendmail: all
# /etc/hosts.allow: list of hosts that are allowed to access the system.
# See the manual pages hosts_access(5) and hosts_options(5).
#
# Example: ALL: LOCAL @some_netgroup
# ALL: .foobar.edu EXCEPT terminalserver.foobar.edu
#
# If you're going to protect the portmapper use the name "rpcbind" for the
# daemon name. See rpcbind(8) and rpc.mountd(8) for further information.我的hosts.deny文件:
# /etc/hosts.deny: list of hosts that are allowed to access the system.
# See the manual pages hosts_access(5) and hosts_options(5).
#
# Example: ALL: some.host.name, .some.domain
# ALL EXCEPT in.fingerd: other.host.name, .other.domain
#
# If you're going to protect the portmapper use the name "rpcbind" for the
# daemon name. See rpcbind(8) and rpc.mountd(8) for further information.
#
# The PARANOID wildcard matches any host whose name does not match its
# address.
#
# You may wish to enable this to ensure any programs that don't
# validate looked up hostnames still leave understandable logs. In past
# versions of Debian this has been the default.
# ALL: PARANOID
ALL: .vk.com
ALL: .ria.ru
ALL: facebook.com我的hosts文件:
127.0.0.1 localhost
127.0.0.1:82 testsecond
127.0.1.1 shc
127.0.2.2:81 someth.com
127.0.2.2:83 test
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
fe00::0 ip6-mcastprefix
fe02::1 ip6-allnodes
fe02::2 ip6-allrouters我确实遵循所有关于设置主机*文件的建议,而且我仍然可以访问它们。我必须做些愚蠢或错误的事。
对我来说,他们似乎被忽视了。
发布于 2014-08-09 12:44:51
hosts.deny用于服务器,而不是在计算机上运行的客户端,因此您不能用它阻止网站。我建议为您的系统阅读hosts_access(5)手册页(Debian版本,FreeBSD版本)。
顺便说一句,伦纳特·波特林( Lennart Poettering )在费多拉( Fedora )提出了一项建议,摆脱tcpwrappers/tcpd和OpenSSH也会这样做。
https://unix.stackexchange.com/questions/149394
复制相似问题