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

How to remove Swap Space from Centos 7.x?

Please refer to the following steps to remove Swap space from Centos 7.x At first, check if...

How to Increase Open Files Limit in Ubuntu?

You may receive a message on Linux system like "Too many open files". This mean server has...

How to Find All Files Owned by a Specific User in Unix/Linux?

You might receive an issue where you require to find all the files that are owned by a specific...

How to install CentOS Web Panel on CentOS 7.x

This article will guide you on how to install CentOS Web Panel on CentOS 7.xCentOS web panel is...

How to block an IP address using .htaccess?

You can block traffic coming from any specific IP addresses with .htaaccess file. Please refer to...

  • 0 Users Found This Useful

Was this answer helpful?