scp files from amazon linux machine to virtual box [closed]

主宰稳场 提交于 2019-12-11 13:34:37

问题


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.


回答1:


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



回答2:


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>


来源:https://stackoverflow.com/questions/33265944/scp-files-from-amazon-linux-machine-to-virtual-box

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!