0

Using Ubuntu 22.04. My fstab entry:

some_user@some_storagebox.com:~/somedir /mnt/volume fuse.sshfs defaults,allow_other,reconnect,_netdev,users,ServerAliveInterval=15,identityfile=/root/.ssh/id_rsa,uid=101,gid=101,ServerAliveCountMax=3 0 0

The first interesting thing is that I'm trying to test if fstab line works by trying to mount volume with:

mount /mnt/volume-1

storage requires to enter password although I'm using rsa key with

identityfile

parameter.

After reboot volume wasn't be mounted. I have no clue why it happening.

fueggit
  • 101

1 Answers1

0

If you are trying to mount an sshfs volume using fstab and you are being prompted for a password even though you are using an rsa key with the identityfile parameter.

One possible solution is to use the sshpass command in your fstab entry. The parameter would look like such, and simply executes sshpass -f /root/sftp.pass ssh when connecting:

ssh_command=sshpass\\040-f\\040/root/sftp.pass\\040ssh

For example, to connect as username with password secret to a server sftp.example.com on port 2222 your fstab entry could look something like this:

username@server:/remote/directory /local/mountpoint fuse.sshfs defaults,_netdev,user,idmap=user,uid=1000,gid=1000,allow_other,reconnect,ssh_command=sshpass\\040-f\\040/root/sftp.pass\\040ssh,port=2222 0 0

You can also check out this Ask Ubuntu post which explains how to auto mount sshfs volume through fstab with password auth.

I hope this helps