Home > How-To > Easy Passwordless SSH

Easy Passwordless SSH

Disclaimer: This is not secure and is intended only for basic usage, because it sucks when you can’t implement something so simple in a short time. (example: for file backup to a remote server)

Scenario: You want to access the remote server from the localhost. Or, you want to backup files from localhost to a remote server. All without the trouble of entering password (also removes the human factor and allows automation).

LOCAL:
L$> ssh-keygen -t dsa
Do not type in any passkey. Just press enter.
L$> ls ~/.ssh/
L$> cat ~/.ssh/id_dsa.pub

Copy the entire line, from ssh-dss to user@localhost

REMOTE:
R$> ssh user@remote
R$> vi ~/.ssh/authorized_keys

Paste what was copied from the localhost.

LOCAL:
L$> ssh user@remote
It should not ask for your password.

Now that you have it working, it’s time to scrutinize the options a bit more to secure your system. Some things you can look at are (but will no longer be discussed here):

  1. adding passkey (addt’l steps required)
  2. renaming key
  3. generating different keys for separate users/applications.
  4. make your authorized_keys file readable only by you.
Categories: How-To Tags: ,
  1. anders
    Saturday, 11 Jul 09 at 01:03:05 am | #1

    Thanks for all info.
    Anyway, you might want to take a look at the man pages for ’ssh-copy-id’. It’s a great tool for copying public keys.