How to Set Up SSH Keys on Ubuntu 18.04 LTS


SSH, or secure shell, is an encoded convention used to manage and speak with workers. When working with a Ubuntu worker, odds are you will invest the greater part of your energy in a terminal meeting associated with your worker through SSH.
In this post, We will generate the ssh key using ubuntu 18.04 LTS.
Step 1: Creating the RSA Key Pair
Use the given command to generate the ssh-key pair.

sudo ssh-keygen

Step 2: Copy the Public Key to Ubuntu Server

Now we need to copy the ssh key with given command to target linux machine.

sudo ssh-copy-id username@remote_host

Step 3: Disable Password Authentication on your Server
To protect our linux machine, We need to disable password based authentication with linux machine, It will be work only ssh key based authentication.  

sudo vim /etc/ssh/sshd_config

Change the PasswordAuthentication yes to no like this.

PasswordAuthentication no

Save and exit from the text editor, To get new change in ssh, We need to restart the ssh service.

sudo systemctl restart sshd.service


We have successfully generate the ssh key and change the auth method on Ubuntu 20.04 LTS.

How to Set Up SSH Keys on Ubuntu 18.04 LTS

One thought on “How to Set Up SSH Keys on Ubuntu 18.04 LTS

Leave a Reply

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

Scroll to top