How to Change SSH Default Port of Linux OS

To access the VPS or server we usually use an SSH connection to setup, install, and configure the VPS or server, many of us leave the default ssh port which is port 22 as it is and that is something that is not recommended in terms of security of a VPS or servers.

This short guide will provide steps on how to change the default SSH port on a VPS or server with Debian, Ubuntu and CentOS operating systems so that it can further increase the security of your VPS or server.

The stages are as follows:

    1. Install the NANO text editor, to make it easier to change the server configuration via ssh: Debian/Ubuntu: apt-get install nano CentOS: yum install nano
    2. Open the SSH configuration file using NANO nano /etc/ssh/sshd_config
    3. After entering the SSHD configuration file, look for text port 22, if at the beginning the text begins with the character #, then remove the # character so that the configuration can be run by the operating system then change the number 22 to a number that you like and is easy for you to remember. For example, we change it to: port 2233
    4. Save the new SSHD configuration by pressing CTRL + O
    5. Exit the SSHD configuration file by pressing CTRL + X
    6. Restart the SSH daemon for the new SSHD configuration to take effect. Debian/Ubuntu: restart ssh CentOS: service sshd restart
    7. After that, then when you log in to the server via SSH, you must enter the port that you have set. Example using putty :
    8. Example using terminal: ssh [email protected] -p 2233
Was this answer helpful?

Related Articles

How to turn off the VPS?

Please Login to Mikyhost = > Click VPS Package = > Click Shut Down thanks,

How do I turn on my VPS?

Please Login to Mikyhost = > Click VPS Package = > Click Power on   thanks,

How to Reset VPS Password?

Resetting password on VPS Package Please Login at Mikyhost = > Click VPS Package = > Click...

How to Restart VPS?

How do I restart the VPS? Please Login to Mikyhost => VPS PACKAGE => CLICK REBOOT

How to reinstall/rebuild VPS

Please enter the VPS Panel and click Rebuild and select the images to be reinstalled. thanks,