Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to recursively chown a VirtualBox shared folder, but I can't get it to work:

$ ls -lah
total 16K
drwxr-xr-x  4 root root   4.0K Aug  1  2012 .
drwxr-xr-x 23 root root   4.0K Jul 21  2012 ..
drwxrwx---  1 root vboxsf 4.0K May  4 17:02 sf_dev
drwxrwx---  1 root vboxsf 4.0K Sep  2 10:21 sf_dropbox
$ sudo chown -R pknight:pknight sf_dropbox && ls -lah
total 16K
drwxr-xr-x  4 root root   4.0K Aug  1  2012 .
drwxr-xr-x 23 root root   4.0K Jul 21  2012 ..
drwxrwx---  1 root vboxsf 4.0K May  4 17:02 sf_dev
drwxrwx---  1 root vboxsf 4.0K Sep  2 10:21 sf_dropbox

I'm aware that I could just add a user to the vboxsf group (as it has full permissions), but I don't want to give every user/daemon full permissions to all of my shared folders.

I'm running VirtualBox 4.2.x, with Windows 7 as the host and both Xubuntu and Debian as guests.

Is there any way for me to change the owner/group of my VirtualBox shared directory?

share|improve this question

1 Answer 1

up vote 7 down vote accepted

The VirtualBox shared file system (vboxsf) doesn't support POSIX permissions per se; rather, they are "set" at mount time:

$ mount
...
dropbox on /media/sf_dropbox type vboxsf (gid=1001,rw)

The gid bit specifies the group that owns the directory; on my system, this happens to correspond with the vboxsf group.

You can alter the user and/or group ownership by remounting (must be done as root):

# mount -t vboxsf -o remount,gid=1000,uid=1000,rw dropbox /media/sf_dropbox

Replace 1000 with the desired user/group IDs, and dropbox with the name of the share (the part after sf_).

Note that this must be done after every reboot unless you edit /etc/fstab.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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