SSHFS and multi-user access
In a situation described in a previous post, i needed to setup apache with PHP files for being hosted in another machine, for the effect i used SSHFS to mount a remote directory in my Document Root over SSH, it uses Fuse and only requires a SSH server running in the target machine. So i wrote an init script to mount that directory before apache starts using a RSA SSH key for the login. But when i tried i always get an HTTP 403 permission denied error, checked and double checked for permissions, and everything was right. Ok, the problem is described here, since SSHFS uses Fuse, fuse doesn’t allow other users than the one who mounted the remote directory to have access to it.
You have two options:
- Confiure /etc/fuse.conf setting the user_allow_other option
- Mount your remote directory as the user who’s gonna access it (if it will be only one user, like www-data), you can do it with the sudo -u option. man sudo for more info.