To change the SSH port number login as root, and edit /etc/ssh/sshd_config

To change the SSH port number login as root, and edit /etc/ssh/sshd_config

Find the line that says Port 22 and change 22 to any number between 1024->65535 (above 30000 is best) and save the file.

Once done, run:

/etc/init.d/sshd restart

Now start a new SSH session (don’t close your existing one), to make sure that you can get in.

[~]# cp /etc/ssh/sshd_config /usr/local/src/backup/
[~]# vi /etc/ssh/sshd_config

# cat csf.conf |grep 2242
TCP_IN = "20,21,22,25,53,80,110,143,443,465,587,993,995,2077,2078,2082,2083,2086,2087,2095,2096,2222"

# cat /etc/ssh/sshd_config|grep 2222
Port 2222

# /etc/init.d/sshd restart
Stopping sshd:                                             [  OK  ]
Starting sshd:                                             [  OK  ]
root@nitin [/etc/csf]