CentOS 6.0 modify the ssh remote connection Port
Operating System: CentOS
Remote Connection Tool: SecureCRT
Tutorial task: Modify the ssh remote connection port in CentOS 6.0
Tutorial steps:
1) add Port 9899 as follows:
A) Method 1:
[Root @ www ~] # Vi/etc/sysconfig/iptables # Add the following statement to the file;
-A input-p tcp-m state -- state NEW-m tcp -- dport 9899-j ACCEPT
[Root @ www ~] #/Etc/init. d/iptables restart
B) Method 2:
[Root @ www ~] # Iptables-a input-p tcp-m state -- state NEW-m tcp -- dport 9899-j ACCEPT
[Root @ www ~] #/Etc/init. d/iptables save
[Root @ www ~] #/Etc/init. d/iptables restart
2) modify the ssh port configuration file
[Root @ www ~] # Vi/etc/ssh/sshd_config
Add Port 9899 under Port # Port 22
# Port 22
Port 9899
[Root @ www ~] # Service sshd restart
3) remote connection to CentOS
4) prohibit root users from logging on remotely through ssh.
[Root @ www ~] # Vi/etc/ssh/sshd_config
PermitRootLogin yes is changed to PermitRootLogin no, and the preceding comment # is canceled so that the root user cannot log on remotely! You can log in with a common account. To use the root account, run the su root command to switch to the root account.
# PermitRootLogin yes
PermitRootLogin no