How do I set the Apache2 DocumentRoot to a "vboxsf" VirtualBox Shared Folder? (permissions issue?)

Solution 1:

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.

Solution 2:

That looks like a permissions issue. You'll need read and execute permission on /media/sf_Dev/ for "other" (the third group of permission bits, which are currently no permissions or ---).

So, you'll need to run this command (since it's Ubuntu, note the sudo):

sudo chmod 775 /media/sf_Dev/

That will add read and execute for "other" and leave full permissions for owner and group.

Also make sure that the index file actually exists in /media/sf_Dev/. (I'll assume that you forgot the sudo in the cp command and that you're not running as root.)

Solution 3:

You didn't say what the specific error was, only

and Apache doesn't seem to see the index.html I put in that directory

The specific error would help. You can file this in Apache's error_log, which is typically under /var/log/apache2/error.log under Ubunt, but can be configured via an ErrorLog Directive in your <VirtualHost>

Without the actual error, I assume George Marian is correct and it's a permissions error. You can check to see what group Apache is running under using:

ps -o pid,group -o atime,comm=CMD awx | grep apache

Try chainging permissions on /media/sf_Dev/ as he said.

I think you may better off handling this with an Alias directive as that will allow you to make only certain parts of your DocumentRoot point to locations outside:

Alias /info /media/sf_Dev
<Directory /media/sf_Dev >
  Order allow,deny
  Allow from all
</Directory>

EDIT: If the Apache server has mod_php (not FastCGI PHP) and is not using suexec, you can determine if Apache is running under the proper GID (group ID) with the following PHP snippit:

<?php

var_dump(posix_getegid());

Make sure that returns the same GID as vboxsf. (You can find the GID for vboxsf in /etc/groups)