Monday, April 14, 2014

How to Fix SSHFS Mounts Not Writable by PHP

Problem:
When accessing a php file in the browser that uses is_writable(), is_dir(),... etc of a mounted directory through sshfs, PHP sometimes cannot detect the mounted directory so the functions above always returns false.

1.) Steps to resolve:
$> sudo adduser $USER fuse
$> ls -l /etc/fuse.conf
$> sudo chmod a+r /etc/fuse.conf

2.) Edit fuse.conf and enable user_allow_other
$> sudo vim /etc/fuse.conf

3.) Connect with allow_user
sshfs -o allow_other,uid=1000,gid=33 user@192.168.1.101:/path/to/mounted/mydir mydir