SSH To An Ubuntu VirtualBox From A Mac

I have been setting up an Ubuntu Server instance using VirtualBox on my Macbook Pro for some development work. I thought I’d share how to get ssh working on the virtual server once you have it installed.

Firstly you need to make sure you have openssh-server on your Ubuntu instance.

On the Ubuntu Server…

sudo apt-get install openssh-server

If you change networks a lot, you’ll probably want to install a static IP you can always connect to safely to access your Ubuntu Server. To do this…

On the Ubuntu Server, edit /etc/network/interfaces, and add the following…

auto eth1
iface eth1 inet static
address 192.168.56.10
netmask 255.255.255.0

Now on your Mac…

Power down the VM

Go to network settings

Add adapter 2
– Attached to Host-only Adapter
– Name vboxnet0

Restart the VM

You should be able to connect to your Ubuntu Server now on 192.168.56.10 from your Mac.

ssh username@192.168.56.10

One thought on “SSH To An Ubuntu VirtualBox From A Mac”

Comments are closed.