scp between two virtual machines in virtualbox

1.1k views Asked by At

I am currently running two virtual machines using virtualbox, one is an ubuntu 14.04 and the other one is a centOS7 on a redhat (64 bit) system. What I am trying to do is to write a shell script that simply copies a file to my centOS7 machine, I am running this script in my ubuntu machine and the file is on the Ubuntu virtual hard drive. I have so far set the IP in my CentOS7 to be static to xxx.xxx.xxx and the script is simply written as scp file_to_move [email protected]:/here/.

but it does not work I wonder is there something I need to configure in my virtualbox or is the script plain wrong?

1

There are 1 answers

1
W.F. On

1) Have you installed ssh-server on your ubuntu machine

2) Have you generated the public/private e.g. RSA keys pair to enable the batch usage of ssh client in your script

3) Have you properly configured the VirtualBox eth cards so that both your machines are in the same network (machines can ping one another)

...

As you can see there may be a lot of reasons why you cannot copy files between your machines and without additional environment information it is hard to say what is causing the issue in your case.