SSH Key Pairing
This is going to be a very short post. I’m going to tell you in simple terms how to setup ssh key-pairing for automatic login via ssh. In this example we will have two computers – a server and a workstation. We will be connecting from workstation to server remotely(or in the same network, it doesn’t matter). Follow these steps and you’ll be done in approx 5 min. This tutorial assumes that you know the ip address of the server and can remotely access it already via ssh.
1. On the workstation type the following command:
ssh-keygen -t rsa
This will create two files in the ~/.ssh directory. One is .id_rsa and the other is .id_rsa.pub. I’m not going to cover what these files are, this is only a walk through.
2. Upload the id_rsa.pub file to server and put it in the ~/.ssh directory.
3. On server run the command
cd .ssh touch authorized_keys cat id_rsa.pub >> authorized_keys
4. You’re done! Assuming everything was correct, you should be able to login to your remote server using the ssh command you should not be prompted for a password.