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!

Dave South
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/ December 21st, 2007 at 11:17 am
Franky Mills
Richard
TjL
Thanks for the very handy and very simple explanation. September 11th, 2008 at 11:14 am
minanube
very handy how to, thanks September 18th, 2008 at 3:53 pm