Page 1 of 1

Run Web app on CentOS VM

Posted: 16. Jul 2014, 21:02
by Troncoso
I have a CentOS 6.5 VM setup as a LAMP server with Windows 8.1 as the host.

I setup a shared folder in Virtualbox that contains a web app. In CentOS, I mounted that shared folder in the htdocs directory.

So, the point of this is for my LAMP server to host a web app that's on the Windows host. When I try to access the web app in a browser, though, I get a 401 Forbidden error, meaning I don't have permission.

Well, for testing purposes, I only have a single html file in the web app folder. After mounting the shared folder via:

Code: Select all

mount -t vboxsf -o rw,exec shared shared
I check the permissions in the VM and I have:

Code: Select all

drwxrwxrwx. 1 root root 4096 Jul 14 12:28 shared
for my shared folder and

Code: Select all

-rwxrwxrwx. 1 root root 30 Jul 14 12:28 testfile.html
for my test file.

Now, in Windows and in CentOS I can see and edit the files. So, my only issue is I can't run them in a Web Browser.

Does anyone have any ideas how to make the Windows and Linux permissions work nicely together so I can see the html file in a browser?

Re: Run Web app on CentOS VM

Posted: 16. Jul 2014, 21:16
by Perryg
Try adding your uid and gid to the mount statement.

Re: Run Web app on CentOS VM

Posted: 16. Jul 2014, 21:18
by Perryg
Oh and I seriously doubt that you need exec permission on the folder since Linux can't actually execute window files.

Re: Run Web app on CentOS VM

Posted: 16. Jul 2014, 21:25
by Troncoso
Thanks for the reply. You're right, I don't need the exec. That popped in there when I was trying different things.

I added my uid and gid and that didn't change anything.

Re: Run Web app on CentOS VM

Posted: 16. Jul 2014, 21:31
by Perryg
Did you do a reboot so the permissions would change?

Re: Run Web app on CentOS VM

Posted: 16. Jul 2014, 22:16
by Troncoso
Yes. When the VM restarts, I mount with the uid and gid and I get the same result. Is that what you mean?

Re: Run Web app on CentOS VM

Posted: 17. Jul 2014, 04:28
by Troncoso
To still auto-mount the shared folder and modify the permissions, I had to add an fstab entry:

Code: Select all

shared /var/www/htdocs/shared vboxsf uid=48,gid=48,dmode=775,fmode=775 0 0
This set the user to apache and gave me read and exec on the files, but I still get a permissions error when I try to access them through the web browser.

Re: Run Web app on CentOS VM

Posted: 17. Jul 2014, 04:52
by Troncoso
Sorry for the triple post. But, I solved my problem.

As it turns out, you have to disable selinux for this to work, which isn't a big deal to me because this is just a VM for testing purposes. I hope this helps someone.