Create a gist now

Instantly share code, notes, and snippets.

SSH between Mac OS X host and Virtual Box guest

On Mac OS (host):

Shutdown your VM and do:

VirtualBox > Settings > Network > Add (you will get vboxnet0)

On a terminal ifconfig will show you new interface vboxnet0

VM's Settings > System > check "Enable I/O APIC." VM's Settings > Network > Adapter 2 > host-only vboxnet0

On Ubuntu (guest):

Install OpenSSH Server

Edit /etc/network/interfaces file to append the following lines:

auto eth1
iface eth1 inet static

Run sudo ifup eth1 from the Ubuntu command line. SSH server should be up and running. Switch to your host terminal and enter ssh



awesome. Thanks for sharing o/


worked for me also, thanks!


In case you can't find vboxnet0 try this:

VirtualBox > Preferences > Network > Host-only Networks > Add host-only network (lns)


thanks a lot !


Thank you.


High Five


Nice one! Thumbs up ;)


Thanks for this info, it help it a lot^^,!

I had a initial problem where i still couldn't reach the vbox through

~ $ ssh
ssh: connect to host port 22: Connection refused

Then i checked the "ifconfig" again on the host (MacOSX) and found that vboxnet0's ip address was set to

    ether 0a:00:27:00:00:00
    inet netmask 0xffffff00 broadcast

I just updated the IP Address in the guest (Ubuntu) /etc/network/interfaces and it worked well.

Again thank you very much^^,


Thanks Bunch really helpful


Loving you so much right now. Got it working after half a day.


Yes, hug that man! Thanks.


Thank you!

Just one small thing to notice is that network adapter name on guest machine may not be always 'eth1'. You need to check the name and add that accordingly in place of 'eth1' which happened in my case.


Thank you!
A good tip.


Perfect simple and it works!


nice, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment