0

I have a Ubuntu virtualbox installed Ubuntu Server. My local machine has Ubuntu 12.04 OS. I need to copy files from the /var/www in the virtualbox Ubuntu Server in to my local machine. (My network settings in virtualbox is "Bridged Adapter" and it has a static IP: 192.168.56.101) My local mchine IP is : 192.168.56.1

I tried following

scp -r test.php [email protected]:

It says

Port 22: No route to host
lost connection.

What is wrong here?

Nilani Algiriyage
  • 161
  • 1
  • 4
  • 10

2 Answers2

1

First make sure that you have openssh-server installed on your local machine, if not:

sudo apt-get install openssh-server

Then from your Virtual Machine:

scp /var/www/test.php [email protected]:/home/nilani

Alternatively you could do the other way around, this time from your local machine:

scp [email protected]:/var/www/test.php .
1

You can share some folder on your host machine. Host machine is your "real" Ubuntu where VirtualBox is installed.

For example:

Create folder in your $HOME

mkdir $HOME/vbox_share

Now using this answer share this folder to virtual machine. Don't forget to check automount option, and name it vbox_share

After that you should see this folder on your virtual Ubuntu in the /media/vbox_share


Update

I forgot to say. If you will do this while your virtual Ubuntu is powered on, you should mount shared folder manually:

sudo mount -t vboxsf vbox_share /media/vbox_share

Now just copy /var/www

mkdir -p /media/vbox_share/var/www
cp -R /var/www /media/vbox_share/var/www
c0rp
  • 9,820
  • 3
  • 38
  • 60