Run the command to locate sshd_config file:
find / -name "sshd_config" 2>/dev/null
Sample outputs:
[root@cloud ~]# find / -name "sshd_config" 2>/dev/null /etc/ssh/sshd_config [root@cloud ~]#
Edit the file and set Port option #
Type the following command:
nano /etc/ssh/sshd_config
Locate the line that read as follows:
Port 22
OR
#Port 22
To set the port to 2222, enter:
Port 2222
Save and close the file. Please note that port numbers 0-1023 are reserved for various system services. Hence, I recommend choosing port numbers between 1024 and 65535.
Restart the sshd service using the command:
service sshd restart