How to make ssh keys

16 Jun

SSH keys allow password-less logins

To make ssh key pair (for ssh2)

Host 1:
ssh-keygen -t dsa (or -t rsa)
scp .ssh/id_dsa.pub host2:

On host two, you have to create .ssh/authorized_keys2 and chmod 600 it.
Then add the key to it:
cat id_dsa.pub >> .ssh/authorized_keys2

or do:
cat ~/.ssh/id_dsa.pub | ssh you@other-host ‘cat –
>> ~/.ssh/authorized_keys’
you@other-host’s password:

You should then be able to ssh from host1 to host2 or vice-versa (check both, its not what you think! – i kept thinking it wasn’t wrong, but it was just that i had been trying to ssh the wrong way!)

use ssh -2 -v host2

GOTCHA!!!
– Make sure ~/.ssh is chmod 700
– Make sure ~/.ssh/authorized_keys2 is chmod 600

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: