How to Set Up and Enable SSH on Ubuntu 20.04

SSH, also known as Secure Socket Shell or Secure Shell, is a cryptographic protocol that helps to encrypt communication in unsecured networks where an SSHD is the daemon program for SSH. Together they provide secure communication between two untrusted hosts over an insecure network.

Step 1 : To install it in Ubuntu, use the following command:

sudo apt-get install openssh-server

Step 2 : You may check its status by running command:

sudo service ssh status

Step 3 : We’re going to edit a /etc/ssh/sshd_config file using the vi editor as the root user, so you should type the following command on the terminal:

sudo nano /etc/ssh/sshd_config

Step 4 : Look for a line that contains PermitRootLogin and replace it with the following line:

PermitRootLogin yes

Step 5 : Save the /etc/ssh/sshd_config file

Step 6 : Now it’s time to restart the SSH server. Then your server will be installed, configured, and ready to use. You can test this by executing the following command:

sudo service ssh restart

Step 7 : You can test your SSH server by trying to connect to it and typing on the terminal the following command:

ssh username@ip

Step 8 : Now you will see a message asking for your authorization. Type yes and your password. You’re now connected to your our server through the SSH protocol.

Simplifying SSH connections with a config file

Step 1 : A local configuration must be stored in the .ssh directory of your home directory, and be named config. The full path would look something like this:

/home/user/.ssh/config

Step 2 : This file doesn’t exist by default, but if it’s found, SSH will parse it and you’ll be able to benefit from it. Go ahead and open this file in your text editor, such as nano:

nano ~/.ssh/config

Step 3 : This config file allows you to type configuration for servers that you connect to often, which can simplify the SSH command automatically, for example:

Step 4 : SSH connections with a config file

ssh server95

Add Comment