如何将文件从无业游民的计算机复制到本地主机 [英] How to copy file from a Vagrant machine to localhost

查看:77
本文介绍了如何将文件从无业游民的计算机复制到本地主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将本地文件从Vagrant机器复制到我的localhost,但是我收到一条错误消息:

I want to copy a local file from a Vagrant machine to my localhost, but I am getting an error message:

ssh:连接到主机127.0.0.1端口22:连接被拒绝.

ssh: connect to host 127.0.0.1 port 22: Connection refused.

[user@localhost ceil]$ scp -p 2222 vagrant@127.0.0.1:/home/vagrant/devstack/local.conf .
cp: cannot stat ‘2222’: No such file or directory
ssh: connect to host 127.0.0.1 port 22: Connection refused

我也尝试使用localhost使用,但仍然出现相同的错误.

I also tried using using localhost but still got the same error.

推荐答案

您应该阅读scp的手册页.正确的语法是:

You should read the manual page for scp. The correct syntax is:

scp -P 2222 vagrant@127.0.0.1:/home/vagrant/devstack/local.conf .

大写字母 P 用于端口".小写字母用于保留修改时间.

The uppercase P is for "port". Lowercase is used to preserve modification times.

这篇关于如何将文件从无业游民的计算机复制到本地主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆