Tuesday, April 19, 2016

Enable the ssh access to the Ubuntu VM running on Virtualbox from MacBook host

I have created a Ubuntu 64 bit VM on my macbook.  I enabled the ssh and sftp access to it.

The configuration involves the virtualbox VM setup as well as configuration within the linux.



Here are the steps:

1. Shutdown the Linux VM

The switch is on the up right corner.

2. Create a second network in Virtualbox

Settings > Network > Adaptor 2
Select Host-only Adapter
Select the name "vboxnet0"




3. Start the VM

4. Check the ifconfig

An IP address like this : 192.168.56.xx is associated with a network interface.
The name of the interface is like "ethX" or "enp0sX", where X is a number.



5. Update the file /etc/network/interfaces

sudo vi /etc/network/interfaces

Add the following:



auto enp0s8 iface enp0s8 inet static address 192.168.56.102 netmask 255.255.255.0


6. Check if ssh server is running

ps -ef | grep sshd

If not, you may not have it.  Try step 8 and 7.

7. Install ssh

If you have not installed sshd, here is the command to install it.

sudo apt-get install openssh-server

8. Stop and Start the service

You can disable it:

service ssh stop

and enable it:

sudo service ssh start

That's it.


No comments: