Example of modifying SSH port number in CentOS

Source: Internet
Author: User
Tags ssh centos iptables port number ssh port

1, with putty or other terminals to connect the CentOS system, Vi/etc/ssh/sshd_config, find #port 22

2, remove the #port 22 before the #, and then put the copy to the following, such as the 22nd port to 2020, modified as follows:

Port 22

Port 2020

Save exit

3, in the terminal input service sshd restart return, restart SSH

4, inside the firewall to open 2020 this port number, in the terminal input Vi/etc/sysconfig/iptables carriage return:

Add a row:-a rh-firewall-1-input-p tcp-m state-m tcp--dport 2020--state new-j ACCEPT

Save exit

5, in the terminal input service iptables Restart carriage return, restart the firewall

6, in putty or other terminals with a new port connection CentOS, the correct connection to indicate the configuration is correct, you can enter/etc/ssh/sshd_config file to remove port 22 ports

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.