Using Passwordless SSH - The easy guide. Leopard only.

I’m not sure about anyone else, but I hate remembering passwords, and it’s annoying to type them when you use a ssh session 20 times a day. To take care of all this for me, securely, I use public/private keys to do all the work behind the scenes for me.

I’m going to make this as short as possible, and straight to the point. If you want to be auto-logged-in to a ssh shell, here are the exact commands you need to run.

On your local machine (your mac) run these. Please replace the “username” and “remote” variables with your ssh credentials.

local$ ssh-keygen -t dsa -f ~/.ssh/id_dsa -C you@exampledomain.com (Enter passphrase)
local$ scp ~/.ssh/id_dsa.pub remote (you are copying this file over to the remote computer)
local$ ssh username@remote

On the remote machine, run these.

remote$ cat ~/id_dsa.pub >> ~/.ssh/authorized_keys
remote$ chmod 644 ~/.ssh/authorized_keys
remote$ exit

Then test it out by logging in.

local$ ssh username@remote (keychain access will kick in and allow you to store the passphrase for easy access)

If this doesn’t work, type this on your local machine.

chmod 400 ~/.ssh/id_dsa

Leopard’s keychain will now ask you for the passphrase. Once you enter this and click remember password, you won’t be prompted anymore for this passphrase!


 
 

5 Responses to “Using Passwordless SSH - The easy guide. Leopard only.”

  1. 4Avatars
    Dave South
    I can't believe you are advocating using no-passphrase SSH keys! If ANYONE gets a copy of your private key they'll have complete access to any server using that key. This is WAY worse than just hacking one of your server passwords.

    And with Leopard, you don't have to remember the SSH passphrase anyway. Why? Because Leopard integrates the SSH-AGENT and the system keychain to securely remember your SSH passphrase for you.

    Please read up on it:

    http://www.appeddesign.com/2007/10/29/leopard-auto-saves-ssh-keys

    http://www.paosborne.com/blog/?p=369

    http://www.dribin.org/dave/blog/archives/2007/11/28/ssh_agent_leopard/

    http://www.ormset.no/wordpress/2007/10/28/leopard-finally-supporting-ssh-agent-at-login/

  2. 4Avatars
    Franky Mills
    Article corrected. Until leopard, this was a pain, good thing apple added this feature. I still use it without a passphrase, but I have for years without a problem. But you are correct in using keychain to be more secure.

  3. 4Avatars
    Richard
    Passwordless SSH is required for many applications in a clustered computing environment. If the private network among the clustered nodes is secure, there should be no problems.

  4. 4Avatars
    TjL
    Wow. I can't believe it took me this long to set this up and this is all that's required.

    Thanks for the very handy and very simple explanation.

  5. yap, remembering all password that we use is a pain.

    very handy how to, thanks

Post a comment to "Using Passwordless SSH - The easy guide. Leopard only."



Support MacTips

MacTips Newsletter


Random Popular Tips

Recent Comments

Recent Discussions

MacTips Poll

What level of tips would you like to see?

View Results

Loading ... Loading ...

Friends of MacTips

Subscribe to MacTips

Site Links