SSH login using keys

Here’s how to setup SSH so you can use keys for authentication.

1. Create a set of keys:

ssh-keygen -t dsa

2. Hit “Enter” three times, we want the default location for the keys, and no passphrase.
3. You should now have a folder called .ssh in your home folder. Inside are the public and private keys.
4. Use SCP to copy the public key, “” to your remote hosts.

scp .ssh/ me@

5. On each host create a .ssh folder in the account you want to access on the remote host (can be multiple accounts).

mkdir .ssh

6. Move (or copy if multiple) the file inside the .ssh folder, renaming it to authorized_keys

mv ~/.ssh/authorized_keys

7. Set the folder permissions on .ssh to 700.

chmod 700 ~/.ssh

Log out of the host and try logging back in. If everything is still set to defaults, you should be logged into the remote host without using a password.

This method is as secure as the interactive login but you need to guard your private key.


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 )

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