Restrict remote login IP on Linux

Source: Internet
Author: User

1) White list form

requirements: Only allow 192.168.0.11 and 192.168.0.10 login All other forbidden

implementation:
1. Vim/etc/hosts.allow//Add the following:
sshd:192.168.0.11, 192.168.0.10

2. Vim/etc/hosts.deny//Add the following:
Sshd:all

2) blacklist form

Requirements: only 192.168.0.11 Landing, all other release
/etc/hosts.allow file does not add any content
Modify:
Vim/etc/hosts.deny//Add the following:
sshd:192.168.0.11

after saving the configuration file, you can do it without restarting.
We can understand how these two files work: When the client IP landing server, first to match hosts.allow, if there is this IP, then direct release, if there is no this IP, then see Hosts.deny, If there is this IP (all including all IP) is rejected, if there is no match in Deny, it will also be released. In other words, if none of the two files have a qualified IP, they will be released!

If all two files are in aSshd:all all IP, because the system first to match hosts.allow this file.

This article is from "be doing!" "Blog, be sure to keep this provenance http://zengweidao.blog.51cto.com/8342699/1438221

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.