Search code examples
vagrantosx-yosemitersync

Vagrant rsync synced folder user group issue on Mac OSx


I am trying to setup synced folder using vagrant , the settings work on linux machine perfectly but Mac OSX (10.10), it does not load the folder with expected user/group permission :

 config.vm.synced_folder "./hp", "/var/www/hp",
    :rsync => true,
    :user => 'www-data',
    :group => 'www-data',
    :rsync__chown => true,
    :rsync__verbose => true,
    :rsync_exclude => [".git/"]

So the permissions look like

vagrant@vagrant-ubuntu-trusty-64:~$ ls -al /var/www
total 16
drwxr-xr-x  5 www-data www-data 4096 May 27 13:35 .
drwxr-xr-x 14 root     root     4096 May 10 05:39 ..
drwxr-xr-x  1 vagrant  www-data  952 May 27 16:56 hp
drwxr-xr-x  2 root     root     4096 May 10 12:54 html

Solution

  • should be owner not user so www-data will own the hp shared folder

    config.vm.synced_folder "./hp", "/var/www/hp",
        :rsync => true,
        :owner => 'www-data',
        :group => 'www-data',
        :rsync__chown => true,
        :rsync__verbose => true,
        :rsync_exclude => [".git/"]