2

I'm running an Ubuntu guest VirtualBox instance. I have a host folder web-server being shared with the guest. On the guest, there are two users which need writable access to the shared folder: the daemon user www-data, and a regular SSH login user which I'll call jdoe, who are both members of the group I'll call www-users

On the host, the folder looks like:

$ ls -al /Users/jdoe/web-server
drwxrwsr-x  14 jdoe  staff   448 Jun 19 11:04 .

On the guest, the folder is mounted with:

$ mount -t vboxsf -ogid=www-users web-server /usr/share/host/web-server

And running mount shows:

web-server on /usr/share/host/web-server type vboxsf (rw,nodev,relatime)

I've also attempted to add jdoe to the vboxsf group; jdoe has the following groups:

jdoe adm sudo vboxsf ssl-cert www-users

While the setup appears to work on Windows and Ubuntu hosts, on OS X the guest user does not have writable access to the folder. The permissions on the guest appear as:

$ ls -al /usr/share/host/web-server
drwxrwxr-x 1 root www-users  448 Jun 19 11:04 .

But when logged in as jdoe, I cannot write to the folder:

$ touch /usr/share/host/web-server/foo
touch: cannot touch '/usr/share/host/web-server/foo': Permission denied

If I change the mount to -ouid=jdoe,gid=www-users, then jdoe can write to it, and if I change it to -ouid=www-data,gid=www-users, then www-data can write to it. In either case, other members of the www-users cannot write to the folder.

Another note, I cannot rely on VirtualBox auto-mount, because this needs to work as it does in production, where drives get mounted on the fly.

  • Did you try using rw option of mount? man mount. – ajeh Jun 19 '18 at 18:24
  • On the guest, what groups is jdoe a member of? – Mark Plotnick Jun 19 '18 at 19:07
  • I verified the mount is mounted with rw by default and I've edited the question with the groups: jdoe adm sudo vboxsf ssl-cert www-users – Rich Remer Jun 19 '18 at 19:23
  • (As an alternative to whatever other answers are given) I had similar problems in the past and now I use vagrant to set up VMs on OS X and everything is much easier as it takes care of mounting etc and I use shell scripts to sort out the details like users and dir access. Just in case you can't get any further with your problem and start looking for ways around. – iain Jun 23 '18 at 21:28
  • Please can you specify the version(s) of Ubuntu you are testing, to date this question? Since this seems so weird, I would suggest mentioning the version number of VirtualBox as well. – sourcejedi Jun 24 '18 at 11:47
4
+25

Can you try this ?

mount -t vboxsf -ouid=root,gid=www-users,fmode=664,dmode=775 web-server /usr/share/host/web-server
  • Thanks. This worked for me, for when nginx's root is a mount point from virtualbox – Ryan M Mar 5 at 2:42
  • Thank you, indeed the part fmode=664,dmode=775 fixed a similar issue for me when I was unable to pull git updates on a shared folder. – Frederic Sep 12 at 11:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.