How to change SSH port on Ubuntu?

Please refer to the following steps to change the SSH port in Ubuntu.

  1. Login to your server via SSH.

  2. Open the sshd_config file using the below command.

    # sudo nano /etc/ssh/sshd_config
  3. Check the line which starts with #port 22. We will need to uncomment this line and change the port number to your desired port number. From the default port 22 to port 232.

  4. Save the changes that you have made and exit from the file. Now, you will have to reload the file by performing the following command.

    # sudo systemctl reload sshd
  5. To make sure that everything is working fine or not, you will need to log out the current session and try to login with the new SSH port below format.

    ssh [email protected]_ip_address -p port

That’s it you have successfully changed your SSH port.

Related Articles

Difference Between su and sudo and How to Configure sudo in Linux VPS.

As we know Linux provides much better security. You can set user management policy and user...

How to Setup NTP Server in CentOS?

NTP enables the automatically sync your system time with a remote server. With the help of NTP...

How to deploy Mean.js application to Linux VPS?

Upload Mean.js Files via SFTP In FileZilla Once your mean.js webcontent is ready, you need to...

How to disable anonymous ftp in cpnael?

Note : It is not recommended to use anonymous FTP. It allows any person to access FTP without...

How to Install Tomcat 7 on Centos?

Tomcat is an open-source web server that is built in Java Servlet and JavaServer Pages...

  • 0 Users Found This Useful

Was this answer helpful?