SSH Password less Login

All my servers are linux based, on the KVM machines I use virtual machine manager to create vm’s and shut them down, reboot them etc, but it got annoying that when I kept trying to connect to the host, it was constantly asking me for a password. There must be a better way than this.

Well there is and it’s a called keys.

This is how I setup a key, it’s not the best way as I’m not using passwords, but it’ll give you a starting point.

On the machine you’re going to use to connect to the servers.

ssh-keygen -t rsa

Generating public/private rsa key pair.
Enter file in which to save the key (/home/paulmellors/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in xxxxx.
Your public key has been saved in
The key fingerprint is:
xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx paulmellors@xxxxxx
The key’s randomart image is:
+–[ RSA 2048]—-+
| |
| |
| |
| |
| S |
| . . . |
|o . ooo o |
|+= ooB=. . . |
|o.*o=o+Eo |


To copy the keys to the target machine, use the program ssh-copy-id

ssh-copy-id -i ~/.ssh/ xxxxxx@

You’ll need the password for the username on the host, but once it’s done you’ll have keys on the server in a file called authorised_keys. Any one that has that key on the local machine can connect to the server without a password.

In my case I’m not worried about passwords as it’s not a publicly accessible machine, but I certainly would recommend using them.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s