Creating Public Key for Remote Server

Typing the user name as well as the password is cumbersome, it takes significant time. Here in this tutorial, I show how to get rid of this overhead by introducing the public key. The good part is you need to execute the following steps only once and then you are good to go. In other words, goodbye to the sign-in process.

Steps

1) Run the following command on your terminal to create your key

ssh-keygen -t rsa -b 4096

Just determine the name of the key file:

Enter file in which to save the key (~/.ssh/id_rsa): ~/.ssh/id_deneme

You can safely skip passphrase questions.

You should see similar output to the following figure:

Note that, the location you saved the key file is important, and it will be used by the configuration file. Voila, You are done!

2) If you want to use your key for the server fill the following command accordingly and run:

ssh-copy-id -i ~/.ssh/your_key user@host

3) If you want to use your key for GitHub, all you need to do is get the key and create this key in your GitHub account:

You can get the key by running the following command:

cat ~/.ssh/id_deneme.pub

Then copy the key printed on the screen to your GitHub account (SSH keys)

4) Add the configuration for your GitHub account, (specify key file):

Enter the configuration file first:

nano ~/.ssh/config

Add the following lines to the end of the file:

Host github.com

IdentityFile ~/.ssh/id_deneme

IdentitiesOnly yes

5) You are good to go now :)

Note: For GitHub, use ssh link instead of https link!