The environment:

  • Ubuntu server 12.04 LTS is running on VMWare Fusion with IP address 192.168.1.101 as Host
  • Mac OS X Mountain Lion as Client

In your ubuntu server

Install ssh server

1
$ sudo apt-get install openssh-server

In OS X

Generate a key-pair

1
2
3
4
5
6
7
8
9
10
$ mkdir ~/.ssh
$ chmod 700 ~/.ssh
$ ssh-keygen -t rsa

Generating public/private rsa key pair.
Enter file in which to save the key (/home/b/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/b/.ssh/id_rsa.
Your public key has been saved in /home/b/.ssh/id_rsa.pub.

Copy the public key id_rsa.pub to Ubuntu server

1
$ scp ~/.ssh/id_rsa.pub user@192.168.1.101:/home/user/.ssh/authorized_keys

If everything OK, now you can access via SSH without password

1
$ ssh user@192.168.1.101

Enjoy :)

Reference: SSH/OpenSSH/Keys