geeks geeks - 4 months ago 118
Linux Question

How to copy file from vagrant machine to local host?

I want to copy local file from vagrant machine to local host. But I am getting Error message

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


I tried also using local host still getting same error.

Answer

You need to read manual page for scp. The correct syntax is

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

(the uppercase P for port).

Comments