www-data access sshfs mount point

Angelo Fuchs asked:

I have an Apache2 on a Debian Linux. I mount a sshfs to the directory /mnt/mountpoint/ (it is mounted on boot time via /etc/fstab). It is accessed with a softlink from /var/www/mountpoint.

When I access the directory with a browser I get a 403.

As fas as I can see the user www-data can not read the directory.

Output of ls as www-data:

d????????? ? ?    ?       ?            ? mountpoint

Output of ls as root:

drwxrwxrwx 1 aneuschitzer www-data 4.0K Jun  5 16:27 

My corresponding line in /etc/fstab

sshfs#reader@targethost:/mnt/mountpoint  /mnt/mountpoint        fuse    ro,noexec,gid=www-data  0 0

First I had the options ro,noexec, I tried without noexec. I have read How to set up sshfs to use www-data and tried adding the gid, but it did not help.

My answer:

You need to enable the options allow_other and/or user_allow_other in /etc/fuse.conf. Otherwise only the user who mounted the filesystem can use it. Once you’ve made the change, unmount and remount the filesystem.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.