This page is pulled from project's readme. Links could be broken.

Gem Gem Dependency Status license Donate via PayPal Hire Typist Tech

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

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 (:)
  • --rsh (or -e) is automatically determined by $ vagrant ssh-config automatically
  • --rsync-path is set to sudo rsync
  • Anything after $ vagrant sudo-rsync is passed to $ rsync
  • Never specific --rsh, -e or --rsync-path


Donate via PayPal Donate via PayPal

Love Vagrant Sudo Rsync? Help me maintain it, a donation here can help with it.

Why don't you hire me?

Ready to take freelance WordPress jobs. Contact me via the contact form here or, via email [email protected]

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.

Change log

Please see CHANGELOG for more information on what has changed recently.

Author Information

Vagrant Sudo Rsync is a Typist Tech project and maintained by Tang Rufus, freelance developer for hire.

Full list of contributors can be found here.


Please see CODE_OF_CONDUCT for details.


Vagrant Sudo Rsync is released under the MIT License.