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.
rw
option ofmount
?man mount
. – ajeh Jun 19 '18 at 18:24rw
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