How can I upload a file from guest to host machine?

2,318 views
Skip to first unread message

Kristijan Pokas

unread,
Jun 17, 2014, 3:58:56 PM6/17/14
to vagra...@googlegroups.com
Hello,

How can I upload a textfile from the guest to the host machine?

I know that the folder who is the Vagrantfile is shared with /vagrant, but I need the file on the host machine, because I want to upload the file on a website.

Alvaro Miranda Aguilera

unread,
Jun 18, 2014, 10:18:55 PM6/18/14
to vagra...@googlegroups.com
Hello,

You have a file in the guest vm you want to have in the host.

option a, in the guest copy to /vagrant, and in the host you will have it on the folder there the vagrantfile is
option b, from the host, do rsync -PavzHl -e 'ssh -p 2222' vagrant@localhost:/path/file file

that should copy the file over rsync

if you want to automate step a, you can try

vagrant ssh -c 'sudo cp -a /path/file /vagrant'

that will copy the file in the host, then take it from there.

Does this make sense?

Alvaro



--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages