For years I knew about the security issues related to NFS, but there wasn’t really a solution to that and I didn’t have a multiuser environment to worry about so I lived with it.
More recently though I’ve experimented with sshfs and found it to work really well. So I figured why not try to replace my NFS entry from /etc/fstab with an SSHFS entry?
Not all that hard to do, though there have been a couple of quirks. First I added this to /etc/fstab:
sshfs#user@ip:/dir /home/user/dir fuse defaults,idmap=user,noauto,user 0 0
Note that it’s not mounted automatically. That’s because to mount something using SSHFS you need to give a password or use an SSH key, and root (who runs the startup scripts) doesn’t have my user’s private key.
This works great for mounting it manually (mount /home/user/dir) but not so well for an automount at boot. For that first I tried to add the mount command to my XFCE startup scripts, but it turns out it didn’t run quickly enough. Next thing I tried was to add it to .xinitrc but it seemed to be ignored.
A bit of searching and I found a solution – use ~/.xprofile instead. So this is what mine looks like:
~$ cat .xprofile
And it works great! Now if only I could find a solution for that ridiculous plain-text SMTP protocol…