Operating system: CentOS remote connection tool: SecureCRT lab task: CentOS6.0 modify the ssh remote connection port step: 1) add Port 9899 as follows: a) Method 1: [root @ www ~] # Vi/etc/sysconfig/iptables # add the following statement to the file;
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