Reputation: 2463
Okay, so my setup:
Windows 8.1 host, CentOS 6.5 guest, Virtualbox 4.3.12 I have a folder in My Documents(Windows) that I use as a shared folder in my guest(CentOS), which is mounted in var/www/htdocs/shared
The purpose of this is to host my web project in the VM, but access and edit the files in Windows. And this works pretty well. The files in the shared folder can be accessed on my host and guest and can be edited as needed. I can access the web service in a browser from Windows just fine.
BUT, when I try to run the files in the shared folder from a browser, I get a 403 forbidden error. The permissions on the guest show as rwxrwxrwx, so I don't know why I don't have permission to access them in a browser, and I can't change these in CentOS.
The ways I mounted the drive is like this:
mount -t vboxsf shared shared
mount -t vboxsf -o rw,exec shared shared
mount -t vboxsf -o rw,exec,uid=1000,gid=1000 shared shared
I got the same results for each.
So, that's my issue. How can I access files in a Virtualbox shared folder from my browser on the host?
Upvotes: 0
Views: 2981
Reputation: 2463
To change the permissions on the directory, you can use the dmode and fmode parameters in the mount statement:
mount -t vboxsf -o rw,dmode=775,fmode=775 shared shared
You don't need to specify the uid and gid, but you need to add the apache user to the vboxsf group:
usermod -G vboxsf apache
And finally, what actually made it work is you need to disable selinux. Now I can view/edit my files in Windows and let the VM serve them in a browser. The goal of this was to be able to develop on Windows, but let my web app run in an environment identical to the production server. Hopefully this helps someone.
Upvotes: 1