Public Key Authentication for SSH

by:

No Category

Public Key Authentication for SSH allows users to not need to enter the password when calling ssh related commands.

This tutorial shows in a few lines on how to configure the Public Key Authentication for SSH access.

Generating and Uploading SSH Key

First and foremost, you should generate an SSH key if you have not yet. You can do it by checking if the files ~/.ssh/id_rsa and ~/.ssh/id_rsa.pub exist.

If not, you can run the following command to generate it:

$ sssh-keygen -b 4096

Press Enter when asked a location to save your public key which will save the keys at ~/.ssh/.

Now that you have generated the SSH key, it should be uploaded to the server where you want the key to be. Please follow these steps:

$ ssh-copy-id {YOUR_USERNAME_SERVER}@{SERVER_IP}

You will be asked for your server password. Once this is done, you should be good to go.

In conclusion, this tutorial was short and sweet. There are many other methods to do the same thing such as using scp to copy the keys into the server, or even manually copy and create the keys into the server. I hope this works for you!

Related Posts