Jun 16, 2012
tom

Vagrant set default share permissions

Question

When running a vagrant instance the project folder is mounted on /vagrant automatically. However is mounted with the following permissions

# ll -d /vagrant
drwx------ 1 vagrant vagrant 612 Jun 13 14:41 /vagrant/

I need it to be mounted with (at least) 0770 but I can’t find how. If I run the mount command I see this output

# mount
v-root on /vagrant type vboxsf (uid=1000,gid=100,rw)

I’ve tried both chmod and chown/chgrp, but they won’t work on that mounted folder so my apache user can’t access that folder. I read in Vagrant manual that I can change owner and group but it doesn’t mention nothing about permission.

How can I do that?

Another option could be switch to NFS but in this way it won’t work on Windows platforms and it need to edit local /etc/exports file and it would require root privileges and also it’s pretty annoying, so I’d prefer to not make this change.

Asked by Fabio

Answer

Solved with this line in my Vagantfile

config.vm.share_folder("v-root", "/vagrant", ".", :extra => 'dmode=770,fmode=770')

Credits: http://ubuntuforums.org/showthread.php?t=1434884

Answered by Fabio

Related posts:

  1. Unable to connect to Postgres on Vagrant Box – Connection refused
  2. Mac (10.6.4) AFP Share (Network Applications) permissions issue
  3. Set default permissions for new files (Linux)
  4. Write to windows share mounted in Ubuntu
  5. How do I set default permissions for SFTP for an Ubuntu Server?

Leave a comment