Vagrant Synced Folders


In vagrant.default.yml, while using vagrant_synced_folders, the destination folder is set as owner:root, group:root and I can’t figure out how to change it. I’ve tried a number of mount_options, but no luck. Is there a way to have the vagrant synced folder destination to be set as owner:vagrant, group:www-data (or anything else)?


Please share with us what you’ve tried if you’re looking for help :slight_smile:


I’ve tried what they’ve suggested:

mount_options: ['uid=1000', 'gid=33']

and get this error:

The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mount -o vers=3,udp,uid=1000,gid=33

Stdout from the command:

Stderr from the command:

mount.nfs: an incorrect mount option was specified


Here’s an example that works for me.

# example directory structure
├── site
├── test
└── trellis
# excerpt from vagrant.default.yml
  - local_path: ../test
    destination: /test
    create: false
    type: nfs
    bindfs: true
      o: 'nonempty'
      p: '0644,a+D'
      u: 'vagrant'
      g: 'www-data'
# reload sync folders
$ vagrant reload

# SSH into VM
$ vagrant ssh

# Check ownership of /test dir
$ ls -lh / | grep test
drwxr-xr-x   3 vagrant www-data  102 Nov  6 02:52 test


That worked, thank you so much!