Last update at :2024-06-30,Edit by888u
Debian/Centos two systems are the same, under SSH: Take changing the port to 7438 as an example.
1. Add the changed port to the firewall a. Add firewall exceptions under Centos 7
firewall-cmd --permanent --add-port=7438/tcpRestart the firewall
firewall-cmd --reloadb. Add firewall exceptions under Centos 6
vi /etc/sysconfig/iptablesFind the existing ssh line and change 22 to the new SSH port number
Restart the firewall before
service iptables save service iptables restartc. Add firewall exceptions under Debian
vi /etc/sysconfig/iptablesAdd
iptables -A INPUT -p tcp --dport 7438 -j ACCEPTSave and restart the firewall
/etc/init.d/iptables restart2. Modify the /etc/ssh/sshd_config file.
vi /etc/ssh/sshd_configFind the code below
#Port 22 #AddressFamily any #ListenAddress 0.0.0.0 #ListenAddress ::Remove the # in front of the #Port 22 line and change 22 to another port
Revised example:
Port 7438 #AddressFamily any #ListenAddress 0.0.0.0 #ListenAddress ::3. Restart the SSH service
service sshd restartRecommended site search: free website domain name application, domain name query, Hong Kong cloud server, domain name registration website, mainland China registration-free space, free virtual host application rental server website IP address query free virtual host, Guangzhou host rental,
发表评论