I have an exfat formatted usb drive mounted at /media/usb/drive1/ with root user via /etc/fstab. Now I would like to link my apache2 DocumentRoot which is located under /var/www/websites/ to a subfolder on that usb drive but not moving it there. Like so

/media/usb/drive1/websites/ --> /var/www/websites/

The main intention is to make use of the external storage instead of the limited system storage while keeping the document root in place.

I've think about symlink and mount options but could not figure out how to apply different permissions on source and destination. The package bindfs seem to be the right choice for this task but the following configuration in /etc/fstab somehow blow up the webserver after a reboot.

bindfs#/media/usb/drive1/websites /var/www/websites fuse force-user=www-data,force-group=www-data,create-for-user=webmaster,create-for-group=webmaster,create-with-perms=0770,chgrp-ignore,chown-ignore,chmod-ignore 0 0

How can I achieve a symbolic link to my usb drive and alter the permissions so that I can jail the FTP user webmaster?

  • I think the problem could be related to the USB drive not being mounted yet when Apache is starting. A symbolic link should work fine as Apache will still see the websites entry and start. Any request while the USB is not mounted will return a 404, but once mounted will work correctly (just slower due to USB). – Tigger Nov 17 '17 at 9:08
  • Is it possible that the folder websites on the already mounted usb drive can't be mounted? And what is the cleanest way of linking to the DocumentRoot: a symbolic soft-link or a mountpoint? – pixelmusic Nov 17 '17 at 14:22

Your Answer

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

Browse other questions tagged or ask your own question.