Since none of the answers worked for me and I managed to figure this out, I figured I should share it with the world. My solution also autoreconnects when the mount disconnects and works when the machine boots up without problems. Just add this to your
/etc/fstab file (one-liner):
[email protected]:/ /mnt/location fuse.sshfs defaults,allow_other,_netdev,IdentityFile=/root/.ssh/id_rsa,default_permissions,uid=YOURIDHERE,gid=YOURIDHERE,follow_symlinks,reconnect 0 0
You NEED SSH keys for this apparently. You can copy your SSH keys using
ssh-copy-id or manually - which one you prefer. The automounting only works with SSH keys in other words. You can troubleshoot the SSH connection with editing the fstab file and then calling
allow_other allows when the root has mounted the automount that not only the root can access it.
IdentityFile is the necessary pointer to the SSH key as evidenced in Arch Wiki, but apparently not described what syntax it uses.
Just don't forget to replace the placeholders for uid and gid ;) I think you can comma separate the IDs, but I haven't tried it.
This was super useful for my Nextcloud instance, since I wanted to remotely mount an external storage box and
follow_symlinks allows the required functionality for supporting symlinks in the mount, which is required for Nextcloud when you start using external storage and similar stuff.