Home > Articles > Ubuntu > Using SSH2 Keys on Mac OS X

In Brief: Using SSH2 Keys on Mac OS X

16 jan 2007, Simon Strandgaard

server is Ubuntu linux, client is Mac OS X

server-prompt> uname -a
Linux 2.6.15-23-server #1 SMP Tue May 23 15:10:35 UTC 2006 i686 GNU/Linux

client-prompt> uname -v
Darwin Kernel Version 7.9.0: Wed Mar 30 20:11:17 PST 2005; root:xnu/xnu-517.12.7.obj~1/RELEASE_PPC

CLIENT-STEP1: generate key pair

IMPORTANT leave passphrase empty

client-prompt> ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/Users/username/.ssh/id_dsa):  press enter
Enter passphrase (empty for no passphrase):                         press enter
Enter same passphrase again:                                        press enter
Your identification has been saved in /Users/username/.ssh/id_dsa.
Your public key has been saved in /Users/username/.ssh/id_dsa.pub.
The key fingerprint is:
01:23:45:67:89:ab:cd:ef:01:23:45:67:89:ab:cd:ef username@case.local
client-prompt> cd ~.ssh
client-prompt> cat id_dsa.pub | ssh username@example.com 'sh -c "cat - >>~/.ssh/authorized_keys2"'
username@example.com's password: 
client-prompt> ssh username@example.com
server-prompt>

CLIENT-STEP2: no password

things that uses SSH should now use SSH keys.
I run Subversion and I check that I can commit without typing my password