This story is about accessing the remote Linux based server by using SSH Asymmetric Encryption. My aim here is not to explain the SSH architecture because I don’t want to dig a hole that has already been dug. Details about how SSH works and different encryption methods used are thoroughly explained in this article.
Guidelines
In this tutorial, I am assuming that an administrator has the root access of the remote server and he wants to authorize another user to access it.
- Enable SSH on the server. Follow this tutorial to enable it.
- Generate an SSH key:
ssh-keygen -t rsa
You will be asked to inputs, it's your decision to fill them or not. In the image given below, I have not filled them:
The ssh-key generated below can be found in this folder
~/.ssh/
In the above image, it can be seen that two keys are generated a public and private key. Never share the private key and public key will be used later in this tutorial.
3. Now the administrator will access the remote server and add the public key in a file containing the keys for the authorized users. This file can be found on this path if doesn’t exist create one:
~/.ssh/authorized_keys
Now add the public key in this file, you pubic key will look like this:
Once the key is added, the user can access the server.
4. The server can be accessed using the command given below:
ssh <user>@<ip>
in this above scenario, this command will look like this
ssh irti@<ip>
You should be able to access the server.
Final Thoughts
I hope you have liked this tutorial. Do give me feedback, if anything can be improved. Thank you.