sshfs for normal users

Hey there. So it looks like this is going to be my first real post here and I’m going to talk about sshfs. sshfs (with the help of fuse) allows for simple, rather rudimentary network filesystem. The idea is very simple mount a remote directory on your local computer and make access to that remote directory transparent, i.e. as if it is a local one. sshfs itself is very straightforward and simple, simply run man sshfs and you should be able to do basic stuff. One thing that bothered me for some time was that for some reason I couldn’t use this network mounts over ssh as a normal, unprivileged user. Whenever I attempted to mount a remote folder on a remote computer and map it to a local one accessing this new mount as a normal user would always result in something very similar to this:

% id
uid=1000(ilj) gid=1000(ilj) groups=1000(ilj),91(video),92(audio),100(users)
% lsh /mnt/
ls: cannot access /mnt/hostname-photos: Permission denied
total 40K
drwxr-xr-x  5 root root 4.0K Apr  4 17:10 .
drwxr-xr-x 20 root root 4.0K Mar  1 18:16 ..
d?????????  ? ?    ?       ?            ? hostname-photos
drwxr-xr-x  2 root root 4.0K Mar 16 17:36 tmp
dr-x------  1 ilj  root  28K Feb  2 07:57 vista

The real problem here is that instead of seeing valid permission and ownership information for hostname-photos directory we’re observing an odd array of question marks.

I’m lazy as hell. I postponed figuring this issue out as much as I could… until today. Facing an absolute need to map remote directories to local filesystem I finally found a solution. The solution is using mount options. Since my setup won’t be changing much I decided to create a fstab entry:

/etc/fstab
sshfs#username@hostname:/home/username/photos /mnt/hostname-photos fuse defaults,users,reconnect,allow_other 0 0

This is exactly what made possible access for normal users. Use it.

Mount and umount  as root user your new mount point.

% mount /mnt/hostname-photos
% umount /mnt/hostname-photos

Use mount to see how your mount points are doing

% mount |grep sshfs
username@hostname:/home/username/photos on /mnt/hostname-photos type fuse.sshfs (rw,noexec,nosuid,nodev,max_read=65536,allow_other)