This article is a mirror article of machine translation, please click here to jump to the original article.

View: 11678|Reply: 0

[linux] CentOS modifies 22 default ports SSH default ports

[Copy link]
Posted on 1/15/2016 11:09:46 AM | | |
1. Add ports

vim /etc/ssh/sshd_config

Remove the annotation #Port 22 and wrap the line to add Port 443

If you want to modify the port instead of adding it, it is recommended to keep port 22 first, and then remove it when the new port can be logged in.

443 is actually the port used by https, and 3128 is the port used by squid. It is recommended to use large ports, such as 10000~65535 or above.

Restart the SSH service /etc/init.d/sshd restart

2. The firewall opens port 443

vi /etc/sysconfig/iptables

Join -A INPUT -m state –state NEW -m tcp -p tcp –dport 443 -j ACCEPT

Restart the firewall /etc/init.d/iptables restart

3. Block the default port

After confirming that the new port can be used, it is best to block the default port 22

vi /etc/sysconfig/iptables

at

-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 22 -j ACCEPT

Add a # sign to the comment

Restart the firewall /etc/init.d/iptables restart

Success!




Previous:How to change the root password of Centos
Next:Lately, have you been getting calls from 10016? Reasons why never answer the phone
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com