Install the openssh-server to perform an installation of the SSH server on your Ubuntu 20.04 system:

$ sudo apt install openssh-server

Check the status. After the SSH server package installation the SSH server daemon should be up and running. To check the status of your SSH server execute the following command:
$ systemctl status sshd

To startstop and restart your SSH server uses the systemctl command. For example, the below command will restart the SSH server daemon:

$ sudo systemctl restart ssh

 Open SSH port 22 for incoming traffic on your firewall:

$ sudo ufw allow ssh

Enable the SSH server to start automatically during the boot.
$ sudo systemctl enable ssh

Connect from a remote client to your SSH server. First, obtain an IP address of your SSH server. To do so execute the bellow ip command:
$ ip a

In case you wish to connect to your SSH server over the internet you will need to obtain your external IP address:

$ echo $(wget -qO - https://api.ipify.org)

Lastly, connect to your SSH server remotely using the following SSH command syntax ssh username@hostname-or-ip-address.

For example, the bellow command will connect to the Ubuntu 20.04 SSH server with an IP address 192.168.1.112 as a user linuxconfig:

$ ssh [email protected]


(optional) From security reasons it is recommended to change the default SSH port 22 to some other arbitrary port number above 1024. To do so edit the /etc/ssh/sshd_config configuration file as an administrative sudo user.

For example to change the default SSH port number from 22 to eg. 8282 add the following line to the SSH config file:

Port 8282

Once you have made the appropriate change open a firewall port to correspond with the new SSH port:

$ sudo ufw allow 8282/tcp

To apply the change to your SSH server use systemctl command to restart it:

$ sudo systemctl restart ssh

To remotely connect to a specific SSH Server port number use the -p ssh command line option. Example:

$ ssh -p 8282 [email protected]

Was this answer helpful? 0 Users Found This Useful (0 Votes)