Jonathan Arbib

Shortest passwordless ssh tutorial, ever

by on Aug.05, 2008, under Tutorials

I am readapting this tutorial from here for reference purposes only :-)
Update: Thanks Mike G for typo/fix/correction

local$ ssh-keygen -t dsa
local$ scp ~/.ssh/id_dsa.pub remote:~/
local$ ssh username@remote
remote$ cat ~/id_dsa.pub >> ~/.ssh/authorized_keys
remote$ chmod 644 ~/.ssh/authorized_keys
remote$ exit
local$ ssh username@remote

Now instead of the normal password you should be asked for the password you entered for your dsa key. This isn’t passwordless yet but shows that ssh is using the key

Note: Leave Key password blank to have passwordless authentication

Fixes for possible problems:

chmod 0600 authorized_keys
ln -s authorized_keys2 authorized_keys (or viceversa)
:, , , ,

2 Comments for this entry

  • Will

    Good thing you posted this as a reference — the original at http://blogs.translucentcode.org/mick/archives/000230.html seems to be down as of 25-Jun-2010…?

    Thanks!

  • Mike Godin

    In most cases, there needs to be a colon after “remote” at the end of line 2 or else id_dsa.pub is just copied to a local file named “remote”. The following works for me:

    local$ ssh-keygen -t dsa
    local$ scp ~/.ssh/id_dsa.pub username@remote:
    local$ ssh username@remote
    remote$ cat ~/id_dsa.pub >> ~/.ssh/authorized_keys
    remote$ chmod 644 ~/.ssh/authorized_keys
    remote$ exit
    local$ ssh username@remote

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Blogroll

A few highly recommended websites...