IP address access control for CentOS

Source: Internet
Author: User
Assume that there are a bunch of machines in which the IP address of the server to be accessed is 192.168.1.1 and the IP address to be accessed is 192.168.1.2. you don't need to write the rest, and you don't need it anyway. In linux, the SSH connection is basically used. the file control method can be used to implement the connection through hosts. allow and hosts under the/etc directory.

Assume that there are a bunch of machines in which the IP address of the server to be accessed is 192.168.1.1 and the IP address to be accessed is 192.168.1.2. you don't need to write the rest, and you don't need it anyway.

In fact, the linux system is basically connected by using SSH, which can be implemented through file control.

In fact, it is done through the hosts. allow and hosts. deny files under the/etc directory.

The hosts. allow file is used to add IP addresses allowed for access:

# Perform the following steps on the 192.168.1.1 server

# Vi/etc/hosts. allow

Add this file

Sshd: 192.168.1.2

Save and exit;

# Vi/etc/hosts. deny

Add this file

Sshd: all

Save and exit.

In this way, only 192.168.1.2 can access the machine 192.168.1.1 through SSH. other servers can be pinged but cannot log on.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.