Ubuntu – How to set the Apache2 DocumentRoot to a “vboxsf” VirtualBox Shared Folder? (permissions issue?)

apache-http-serverUbuntuvirtualbox

I setup Ubuntu 11.04 desktop 32 bit on a VirtualBox VM with a shared folder to the host. The shared folder is

/media/sf_Dev/

I want to change Apache2 to point the DocumentRoot to that folder, so I edited /etc/apache2/sites-available/default to replace the existing two paths in that file to /media/sf_Dev/ instead of /var/www and it won't show index.html.

When I look at /var with ls -l I see

drwxr-xr-x  2 root root ... www

and when I ls -l /media/ I see

drwxrwx---  1 root vboxsf ... sf_Dev

and Apache doesn't seem to see the index.html I put in that directory (cp /var/www/index.html /media/sf_Dev/ iirc)

I also tried editing envvars to make the group be vboxsf but I think I did that part wrong.

export APACHE_RUN_GROUP=www-data

to

export APACHE_RUN_GROUP=vboxsf

What am I doing wrong, what do I need to do to get Apache2 to serve files from that directory? (technically I want to serve files for apache from /media/sf_Dev/apache/www but I figure one step at a time, so if that helps you short-circuit things, so be it)

Best Answer

It would probably be easiest to add the vboxsf group as a supplementary group for apache.

Ubuntu:

sudo usermod -a -G vboxsf www-data

Fedora:

sudo usermod -a -G vboxsf apache

This does it for me when I want to access auto mounted shared folders. You might also want to add your own username to the vboxsf group to access the files.

Related Question