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


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


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)


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


sudo usermod -a -G vboxsf www-data


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.

| improve this answer | |
  • But is the apache app running under the username apache? I thought that changed >.> – jcolebrand Sep 16 '11 at 21:42
  • You're correct, I mixed the apache user for fedora and ubuntu. edited :) – Fuu Sep 16 '11 at 23:23
  • 1
    Saved me a bunch of time fiddling around with manual mounting.. thanks! – xorinzor Jul 7 '13 at 15:57
  • This solution fixed it for me on Ubuntu 15. Many thanks! – Ian Lewis Nov 4 '15 at 12:53

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.)

| improve this answer | |
  • 1
    Ahhh, but when I do that it doesn't make the changes I need. Something about the vboxfs doesn't let those changes get made (ie: like NFTS) ... oooh, which may be the problem, the files are originally hosted on NTFS (since it's a windows host) so I don't think I can do that. ~~ I had forgotten to look at the errorlog before asking. I shall check that this evening. However, assume it's a permissions error. – jcolebrand Sep 14 '11 at 15:48
  • @jcolebrand Rule #1 of troubleshooting: is it plugged in? Nevermind that I'm thinking about the long term usefulness of the answer and that I know you as a DB and .NET guy. :P – George Marian Sep 14 '11 at 21:14
  • @jcolebrand So, silly question: Did you restart apache? sudo apache2ctl restart – George Marian Sep 14 '11 at 21:16
  • hahahahaha, this is why I need help, I'm a db and .net guy ;) ... yeah, I actually dropped into sudo su once it started being a wench so I could go into all the directories and see what was "broken" ... I'm gonna do what Josh suggested later with the PHP file. – jcolebrand Sep 14 '11 at 21:16
  • 1
    It is possible that vboxsf does not support setting permissions for the root folder of file system and it may provide mode, uid and gid mount options to set file permissions globally. – billc.cn Sep 17 '11 at 1:58

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

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:



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

| improve this answer | |
  • I had forgotten to look at the errorlog before asking. I shall check that this evening. However, assume it's a permissions error. See my response to George above – jcolebrand Sep 14 '11 at 15:50
  • OK. Then we should focus on getting Apache to run as GID vboxsf. Can you edit and post the relevant parts where you changed the Group? – Josh Sep 14 '11 at 15:53
  • I edited one line in envvars, and it said group, but I'm not looking at the box right now. – jcolebrand Sep 14 '11 at 15:54

If you have configured the shared folder to be auto mounted. Then you need to first disable the same and mount the shared folder manually. If you need automount it every time you start the vm, you need to add respective entry inside your /etc/fstab. (It seems there is some issue mounting vbox shared folder through fstab. So adding below mentioned command inside /etc/rc.local worked for me to mount it on start).

Load Shared Folder with Correct User / Group

As far as I can tell, this error is due to the owner and group of the shared folder. Apache expects the files to render to belong to the group www-data. By default, however, the shared folder in VirtualBox belongs to the vboxsf user. We will add this user to the www-data group. To do so, edit the group properties on the guest:

sudo usermod -a -G vboxsf www-data

We’ll now mount the shared folder and assign it to the www-data user and group. To check out the user and group id, you can have a look at the /etc/passwd file on the guest machine (cat /etc/passwd | grep 'www-data'). On Debian based OS, both ids are usually set to the value 33. So, simply issue the following command on the guest:

mount -t vboxsf -o rw,uid=33,gid=33 website /media/sf_website

Note that website is the name of the shared folder (as illustrated in the screenshot above) and /media/sf_website is where the folder will be mounted.

Fore more details refer this link http://jimmybonney.com/articles/configure_virtualbox_shared_folder_apache_virtual_host/

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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