I am trying copy a directory from my amazon Linux machine to my virtual-box. I write the following command from my amazon Linux machine:
scp /home/user/test xyz@xyz-VirtuaBox:/home/user
but I get the error message:
Could not resolve hostname xyz-virtualbox: Name or service not found.
I am not sure what's going on. My virtual machine hostname is right.
No! Your virtual machine hostname is not resolvable from amazon linux machine. You should do this the other way round. From virtual machine:
scp xyz@amazon:/home/user/test /home/user
Or the other way is to set up remote port forwarding, so you will be able to connect from your Amazon machine to your virtual box, but it depends if you use Putty or normal ssh. But the general command can look like this:
[local] $ ssh -R 2222:xyz-VirtuaBox:22 amazon
[amazon]$ scp -P 2222 /home/user/test xyz@localhost:/home/user
To make the copy, you need to have an open door to your virtual machine, then use the syntax
scp -pr -P <port> <directory> user@ip:<path_directory_destination>