Ubuntu 20.04 SSH Server
| Category | Requirements, Conventions or Software Version Used |
|---|---|
| System | Installed Ubuntu 20.04 or upgraded Ubuntu 20.04 Focal Fossa |
| Software | OpenSSH |
| Other | Privileged access to your Linux system as root or via the sudo command. |
| Conventions | # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command $ – requires given linux commands to be executed as a regular non-privileged user |
$ sudo apt install openssh-server

OpenSSH server installation on Ubuntu 20.04 Server/Desktop
$ systemctl status sshd

Check the SSH server status. Press q to quit the status page.
To start, stop and restart your SSH server use the systemctl command. For example the below command will restart the SSH server daemon:
$ sudo systemctl restart ssh
$ sudo ufw allow ssh

Open SSH port 22 and check the firewall status
$ sudo systemctl enable ssh

Ensure the SSH Server on your Ubuntu 20.04 system start after reboot
$ ip a
In case you wish to connect to your SSH server over the internet you well need to obtain your external IP address:
$ echo $(wget -qO - https://api.ipify.org)

Obtain a local IP address by using the ip command.
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 linuxconfig@192.168.1.112

Connecting to SSH server remotely. For a first time connection you will need to accept ssh fingerprint by typing yes.
For example to change the defalut SSH port number from 22 to eg. 8282 add the following line into the SSH config file:
Port 8282

Changing the default SSH port number via /etc/ssh/sshd_config SSHD configuration file.
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
In order to remotely connect to a specific SSH Server port number use the -p ssh command line option. Example:
$ ssh -p 8282 linuxconfig@192.168.1.112 source![]()