Copy files from/to a Vagrant VM with sudo and necessary SSH config
$ vagrant plugin install vagrant-sudo-rsync
# General ## This is equivalent to $ rsync --rsh=<automatically determined> --rsync-path='sudo rsync' [OPTION] SRC DEST $ vagrant sudo-rsync [OPTION] SRC [DEST] ## Synchronizing from local to remote $ vagrant sudo-rsync [OPTION] <some_local_file_or_dir> :<somewhere_on_the_vm> ## Synchronizing from remote to local $ vagrant sudo-rsync [OPTION] :<somewhere_on_the_vm> <some_local_file_or_dir> # Real life example ## Listing all files under /etc/nginx/ssl on remote $ vagrant sudo-rsync :/etc/nginx/ssl/ drwx------ 4,096 2017/09/12 00:32:17 . -rw-r--r-- 424 2017/09/12 00:30:48 dhparams.pem -rw-r--r-- 1,054 2017/09/12 00:32:17 www.example.cert -rw-r--r-- 1,708 2017/09/12 00:32:17 www.example.key ## Pulling /etc/nginx/ssl from remote to local desktop $ vagrant sudo-rsync -av --delete --info=NAME :/etc/nginx/ssl ~/Desktop receiving incremental file list ssl/ ssl/dhparams.pem ssl/www.example.com.cert ssl/www.example.com.key sent 85 bytes received 3,469 bytes 7,108.00 bytes/sec total size is 3,186 speedup is 0.90
- Prefix remote paths with colon (
-e) is automatically determined by
$ vagrant ssh-configautomatically
--rsync-pathis set to
- Anything after
$ vagrant sudo-rsyncis passed to
- Never specific
It looks awesome. Where can I find some more goodies like this?
- Articles on Typist Tech's blog
- Tang Rufus' WordPress plugins on wp.org
- More projects on Typist Tech's GitHub profile
- Stay tuned on Typist Tech's newsletter
- Follow Tang Rufus' Twitter account
I love this project. Where can I give a :star::star::star::star::star: review?
Thanks! Glad you like it. It's important to let mw know this project is useful to somebody. Please consider:
- tweet something good with mentioning @TypistTech and @TangRufus
- :star: this Github repo
- watch this Github repo
- write blog posts
- submit pull requests
- hire me
Love Vagrant Sudo Rsync? Help me maintain it, a donation here can help with it.
Why don't you hire me?
Want to help in other way? Want to be a sponsor?
Contact: Tang Rufus
Please provide feedback! We want to make this library useful in as many projects as possible. Please submit an issue and point out what you do and don't like, or fork the project and make suggestions. No issue is too small.
Please see CHANGELOG for more information on what has changed recently.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Full list of contributors can be found here.
Please see CODE_OF_CONDUCT for details.