I'm trying to enter an sshfs mount in /etc/fstab with the following line:
sshfs#oli@192.168.0.2:/media/usb0 /media/ExtHD fuse defaults,nonempty,allow_other 0 0
So that this volume is mounted at boot. After booting up, nothing happens, but when I use the command sudo mount -a, I am always prompted for the password. I have set up SSH Keys and transferred them over to the computer at 192.168.0.2, and can log in to regular ssh with no pasword. How can I stop fuse from asking for my password so that the volume can be automatically mounted at boot time?
If it helps at all, I am trying to connect to a home server running Debian from a laptop running Arch Linux.
Thanks
Best Answer
Key-based authentication can only work if the
ssh
process can find your key. You presumably have your key in your home directory; but you've never toldsshfs
where to look for a key. At boot time, it would beroot
mounting all filesystems, therefore the key must be either in/root/.ssh
or referenced in/root/.ssh/config
.I recommend mounting the filesystem after you've logged in, and as your own user. Put this in a script that's executed when you log in:
Put an alias called
homeserver
in your~/.ssh/config
: