How To Find And Change SSH Port Number? – POFTUT

How To Find And Change SSH Port Number?

ssh  is default protocol used to manage remote systems which are mainly Linux and Network Devices. As it is working over network connection and uses TCP it has a default port number which is 22  . In this tutorial we will look how to change the default port number from client and server point of view.

List Server Port Configuration

Linux ssh server configuration is stored in /etc/ssh folder with a name sshd_config .  This configuration file provides a lot of configuration parameters. We can print current port configuration with the following command by grepping Port text.

Change Server Port Configuration

Change Server Port Configuration

Change Server Port Configuration

In order to change port configuration we just need to remove the # from begging of the configuration line with is listed in previous step. So

will change to the below where number is the port number we want.

and We need to restart the ssh service in order to affect changes.

Change Client Port Configuration

Now we have changes ssh port of the server but how can we specify different port than 22 in ssh client. We use Linux ssh client which uses port 22 as default. We will use -p option in order to specify port number we want to connect. In this example we will connect to the port number 2222

LEARN MORE  How To Install and Setup VNC Server On Linux?

1 Response

  1. 11/09/2019

    […] easily and securely. OpenSSH servers run by default TCP port 22. We call it generally ssh port. Ssh port number is know for the whole world so attackers can attack to beat our OpenSSH server like brute […]

Leave a Reply

Your email address will not be published. Required fields are marked *