Secure Shell (SSH) is a cryptographic network protocol for secure data communication, remote command-line login, remote command execution, and other secure network services between two networked computers that connects, via a secure channel over an insecure network, a server and a client (running SSH server and SSH client programs, respectively).
The default value for ssh port is 22. We can change the port value by editing its configuration file.
SSH configuration file.
How to change the ssh port through command line?
Step 1: Open the SSH configuration file by using your favorite editor.
# vi /etc/ssh/sshd_config
Step 2: By default the port value is commented(Using default port #22) in SSH conf file. Uncomment the line and edit the port value to new.
# vi /etc/ssh/sshd_config ------ # Port 22 Port 2929 ------
Step 3: Restart the SSH daemon
# service sshd restart # /etc/init.d/sshd restart
For a cPanel server you can also use this script for restarting the SSH service.
That’s it. Now your server is more secure than the default SSH.