banner



How To Change Port Number In Linux

How to Alter SSH Port in Ubuntu 18.04

This tutorial explains how to configure Ubuntu OpenSSH server to run on some specific port number rather than the default port number 22, in order to increase the overall security of your Ubuntu server.

The SSH server on Ubuntu heed on TCP port 22 past default. You can run the netstat command to cheque ssh port currently running on:

            netstat -tulnp | grep ssh          
run the netstat command to check ssh port currently running on

As you tin can see, the SSH daemon is currently running on TCP port 22.

In Ubuntu 18.04, the Port directive of the sshd_config config file specifies the port number that ssh server listens on. You can check the current configuration with post-obit command:

            grep -i port /etc/ssh/sshd_config          

The Port directive is commented out past default, which means SSH daemon listens on  the default port 22.

The Port directive of the sshd_config config file specifies the port number that ssh server listens on

If you want to change the default SSH port in Ubuntu, perform the following steps with root privileges:

  1. Open the /etc/ssh/sshd_config file and locate the line:
                    #Port 22              
  2. And then, uncomment (Remove the leading # character) it and change the value with an appropriate port number (for example, 22000):
                    Port 22000              
  3. Restart the SSH server:
                    systemctl restart sshd              

After that, run the netstat command and brand certain that the ssh daemon now listen on the new ssh port:

            netstat -tulpn | grep ssh          

When connecting to the server using the ssh command, you demand to specify the port to connect using the -p flag:

            ssh -p 22000 192.168.1.100          

Notation that if the Firewall is enabled, you need to add a rule to permit new SSH port.

Source: https://www.ubuntu18.com/ubuntu-change-ssh-port/

Posted by: langstonbillostrand.blogspot.com

0 Response to "How To Change Port Number In Linux"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel