The default SSH port is 22. If you wish to change the SSH port for your Linux server to for example 30200 you can do this the following way:
Connect to your server with the default SSH port with the SSH client of your preference.
Edit the configuration file with for example nano or vi
root@dedifix:~$ sudo vi /etc/ssh/sshd_config |
search for “Port”
# What ports, IPs and protocols we listen for Port 22 |
In this case we want to change the port to port 30200
Change the number to 30200,
# What ports, IPs and protocols we listen for Port 30200 |
Exit the text editor and restart the service.
Restart the SSH service on Debian based systems:
root@dedifix:~$ sudo service ssh restart |
Restart the SSH service on Red-hat based systems:
root@dedifix:~$ sudo service sshd restart |
You are now able to connect to your server with port 30200