Adam Bosco's picture

Hello, Turnkey Community!

Background

With the intent to create a development-testing server for website development, I imported the Turnkey LAMP virtual appliance into Virtualbox. My workflow is such that all of my working files are stored on my host machine (Windows 8) in a directory, say M:\Websites.

My desire being to access the sites contained in this directory by simply visiting the URL "http://{LAMP Appliance IP}/{Site subdirectory}," I followed the directions specified in this Turnkey Documentation Tutorial on mounting shared files with Turnkey Linux and Virtualbox in order to create an entry in /etc/fstab that automatically mounts my M:\Websites directory to /var/www/sites via filesystem loopback. The contents of my new entry are as follows:

	/media/sf_Websites /var/www/sites bind defaults 0 0

To complete the process I proceeded to set the document root for my *:80 virtual server to /var/www/sites as opposed to the standard /var/www.

 

Problem

While my fstab entry is succesful (verified by my ability to browse the contents of M:\Websites by transversing /var/www/sites from the LAMP appliance command-line, SSH, and Web-shell), I am given only 403: Forbidden errors when I attempt to visit the URL "http://{LAMP Appliance IP}" or any sub-directory.

Executing "ls -l" within the /var/www directory displays the following permissions for my "sites" mount:

 

drwxrwx--- 1 root vboxsf 16384 May  1 21:37 sites
It is obvious that the final "read" and "execute" bits are not set (which is to my understanding the problem here), but my attempts to modify the permissions via "chmod -R 755 sites" and "chgrp -R www-data sites" all seem to be in vain - while it appears to do the work to modify the permissions, another call to "ls -l" simply displays the same permissions as existed before, and I am still unable to access the directories in my web-browser.

What am I missing here??
Forum: 
Adam Bosco's picture

Worked it out. I was using Virtualbox's "Automount Share" feature which did not allow me to specify the options that I wished the share to mounted with. I removed the automount feature and the filesystem loopback fstab entry that the aforementioned tutorial recommended, and proceeded to create an fstab entry to mount the share with the options I desired:

Websites /var/www/sites vboxsf rw,uid=33,gid=33,umask=0022 0 0
User and Group IDs 33 correspond to the www-data user and group; specifying them in the fstab entry saw that the share was owned by www-data and subsequently grated www-data all privledges on the mount. Umask 0022 is the equivelent of 0755 octal permissions. Works flawlessly. The last bits of Turnkey tutorial regarding mounting a "www" directory, however, are absolute rubbish and arguably misleading or out of date.
Jeremy Davis's picture

I have been really busy so haven't been as vigilant on the forums as I might like.

But excuses aside - I wrote that tutorial. It was a while ago and IIRC I wrote it as I set it up and was busy doing something at the time (I needed to sort this out...) and I vaguely recall that issue. I think I resolved it by just adding www-data to the vboxsf user group... But obviously forgot to go back and add that final note... Sorry about that. Glad you found a solution.

Adam Bosco's picture

Hey Jeremy!

Absolutely no worries, mate! As a whole the tutorial was great, and even having to dig around on-line I can't complain about learning more Linux tricks ;) . Rock on friend.

Anthony C.'s picture

I'm running into the same problem expressed here, but I can't seem to get anything to work now.  I initially had a folder auto mounted and have since removed that and then just added it in without the option. 

I then placed the entry in my fstab which should be mounting the thing, but it isn't mounting at all now.  This is what I have:

Sites /var/www/sites vboxsf rw,uid=33,gid=33,umask=0022 0 0

Sites is the name of the folder that is being shared in Virtualbox and /var/ww/sites has been created.

I've rebooted the machine several times and even tried manually mounting the folder, but that just throws an error: "mount: special device Sites does not exist".

I've tried looking in the logs for errors, but don't see any at all so I have no idea how to get past this.  Can someone assist?  My linux skills are pretty minimal so I don't know where to go from here.

Jeremy Davis's picture

I'm assuming that you do (because the error message that you get suggests that to me). And also make sure that you have the folder shared within VBox UI still too.

The errors you are reporting suggest that your VM just can't see the folder... It sounds like VBox isn't making the share available to the VM. You'll need to work out why that is before you can proceed. My guess it either Vbox isn't passing it through (which you'll need to troubleshoot within VBox settings) or for some reason VBox tools isn't seeing the share...

I wonder if this has something to do with an updated Vbox install or something? You mention that it was working but not now... That suggests that something has changed...

Anthony C.'s picture

Thanks for getting back with me Jeremy.  The addons are installed, but I initially had issues with that - before I saw the writeup here about how to do it properly.  Once I got them installed and I shared the folder automatically, I was able to see it just fine in the VM.  However that's when I ran into all the permissions issues and went to set it up manually.

So I removed the share, rebooted the VM and made sure it wasn't still getting mounted (which it wasn't), added the share in VBox again, but didn't set it up as automatic.  I beleive it is marked as "permanent" though, but that happened automatically.

After several reboots and doublechecking the settings and mount in fstab, still can't see the thing.  Maybe I'll try adding the share again in VBox and see what happens.

Add new comment