Ubuntu Linux server - set file permissions for VirtualBox shared folder

You can set some mounting options while mounting your the shared folder on the guest OS - here are the available options:

http://manpages.ubuntu.com/manpages/maverick/man8/mount.vboxsf.8.html

There are many solutions to your problem:

  • To make the files seen as owned by your VirtualBox user's uid and gid (using the uid and gid mounting options).

  • To override the mode of all files/directories using dmode and fmode options.

  • To change the umask on your host to a less restrictive mask.

I usually prefer the first option. In your case the entry to the /etc/fstab file should look like this:

dev /var/www vboxsf umask=0022,gid=33,uid=33