Admin Books

DOWNLOAD Free e-Books for Linux Admin Servers :

Passwordless SSH Login


Just a quick post on a tool I have found handy through the years. Passwordless ssh. Very very quick to implement on all Linux systems regardless of distro. Also works fine on Solaris.

ssh-keygen -t rsa

Pick the default location to store id-rsa and do not enter a password

Enter file in which to save the key (/home/user1/.ssh/id_rsa):


Enter passphrase (empty for no passphrase):


Enter same passphrase again:


Your identification has been saved in /home/user1/.ssh/id_rsa.


Your public key has been saved in /home/user1/.ssh/id_rsa.pub.





Now you have created your key pair. If you are doing this from your own network login e.g. user1 and you have your home account on storage somewhere all you need to do is this to achieve passwordless ssh login.

cd ~/.ssh


cat id_rsa.pub > authorized_keys

For a regular user, you are done.

For root , you need to scp this authorized_keys file to all your hosts. A simple enough script can achieve this

scp ~/.ssh/authorized_keys root@remote_server:~/.ssh/

Done!

No comments:

Post a Comment