- Login to the server with the console(KVM/Drac/iLO/XenCenter)
- Edit the sshd_config file
- # vi /etc/ssh/sshd_config
- Uncomment Port22 and change it to 8xxx (If there is another port listed then change it to 8xxx)
- Save the file
- Restart the SSH service
- # /etc/init.d/sshd restart
- Test SSH to make sure you can connect
- If you cannot connect then open port 8xxx in the firewall:
- # iptables -I INPUT -p tcp –dport 8xxx -j ACCEPT
- For Xen servers, you will need to edit /etc/sysconfig/iptables and add the following line:
- for xenserver 6.2 and earlier : -A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 8xxx -j ACCEPT for xenserver 6.5 and later : A RH-Firewall-1-INPUT -m conntrack –ctstate NEW -m tcp -p tcp –dport 8xxx -j ACCEPT
- then save the file and restart the firewall with # service iptables restart
- If you cannot connect then open port 8xxx in the firewall:
- Always check the firewall and if there is a rule for port 22 change it to 8xxx. For CentOS this is located at /etc/sysconfig/iptables. After editing the file iptables restart the iptables service.