Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to parse hosts.allow and hosts.deny settings

2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How to analyze hosts.allow and hosts.deny settings, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

Hosts.allow and hosts.deny

Both files are in the / etc/ directory

Priority is to check hosts.deny first, and then check hosts.allow

The latter can be set to exceed the former limit.

For example:

1. Restrict all ssh

Unless it comes from 192.168.10.0 Murray 127.

Hosts.deny:

In.sshd:ALL

Hosts.allow:

In.sshd:192.168.10.0/255.255.255.128

two。 Shut down the telnet of 192.168.10.0 Murray 127.

Hosts.deny

In.sshd:192.168.10.0/255.255.255.128

3. Restrict everyone's TCP connections unless accessed from 192.168.10.0 MULTHI 127

Hosts.deny

ALL:ALL

Hosts.allow

ALL:192.168.10.0/255.255.255.128

4. Restrict access to all services by 192.168.10.0 Muhami 127

Hosts.deny

ALL:192.168.10.0/255.255.255.128

Where the colon is preceded by the name of the service process of TCP daemon, usually the system

The process is specified in / etc/inetd.conf, such as in.ftpd,in.telnetd,in.sshd

Among them, there are several ways to write the IP address range, and the three main ones are:

1. Network address-subnet mask:

192.168.10.0/255.255.255.0

two。 Network address mode (what I call it myself, hehe)

218.64. (that is, the IP address that starts with 218.64)

3. Abbreviate the subnet mask, counting the number of "1s" in front of the binary subnet mask, for example:

192.168.10.0 Compact 255.255.255.0 "= =" 192.168.10.0Compact 24

_ _

After setting it up, restart it

# / etc/rc.d/init.d/xinetd restart

# / etc/rc.d/init.d/network restart

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report