Documents >> Unix >> SSH Key Login

SSH Login with use of pass key

If you often has to logon på different ssh capable servers, you get realy borred with the continous password requests. This is a small guide to installing keys and thereby authorising by key instead of password.

On the machine you want to login from you create the key and copy the public key to the server you want to logon to. First you do the follwing: 

ssh-keygen -t rsa

This command generates a public and a private key. When it ask you where to place the file, you can just press enter because it has allready choosen the .ssh folder in your home folder.

Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):

To the passphrase request you just press enter and leave it without it. BUT it should be mentioned that this is a security thread, because if somebody gets a hold of your private key, they can use it to logon to the servers you have installed your public key at.

Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:

Now the keys has be generated. The next step it to install the public key at the different servers that should be logged on to. This is done by inserting the content of the id_rsa.pub file into the .ssh/authorized_keys file on the server. If the file does not exist is should be created.

If that didn't work for you, check your file permissions on both ~/.ssh/* and server:~/.ssh/*. Your private key (id_rsa) should be 0600 (and only be present on your local machine), and everything else should be 0655 or better.

 


^ Top | Copyright © 2007 Afterschool.dk| css | xhtml