How to Change the Default SSH port in Ubuntu

Change the SSH port in Ubuntu

Change the SSH port in Ubuntu

When I set up an Ubuntu server, I like to set set SSH daemon to a port to something other than the default of port 22. Changing the SSH port doesn’t guarantee security for your Ubuntu server, but it does help hide your server from script kiddies that typically do only scan standard ports for insecure systems.

In order to change your default SSH port, you need to have root access to your Ubuntu server. Edit the /etc/ssh/sshd_config file. Near the top you will see the following line: Port 22. Just change this to the port that you want to use for SSH. Save the file, and restart the SSH daemon with the following command: /etc/init.d/ssh reload or just reboot the Ubuntu server.

Now to login, if you are using a windows PC, and using an application like Putty, just make sure you enter the port number you are using when you configure Putty for your Ubuntu server.

If you are logging in from an Ubuntu computer, just open up the terminal and just add the -p option with the port number. Like this: ssh YOUR-SERVER-NAME -p 5900 In this case, we have configured our Ubuntu server to listen for SSH on port 5900.

A nice tool to use for checking your network traffic is wireshark.

.This article was originally posted on www.mikestechblog.com Any reproduction on any other site is prohibited and a violation of copyright laws.