How to set up ssh keys on ubuntu server 20.10

Follow these steps to set up public key authentication:

Step 1 : Change to the home directory with cd ~/

Step 2 : Create a .ssh directory if it doesn't already exist

Step 3 : Create a file named authorized_keys under the .ssh directory

Step 4 : Set permissions on the .ssh directory to 700

Step 5 : Set permissions for authorized_keys to 600

Step 6 : Generate public key pair on your local system with the following command

Step 7 : Copy the generated public key from the .ssh/id_rsa.pub file to the authorized_keys file on the server.

Step 8 : Now, open an ssh connection from local to server with the following command: