Score:0

Drive in fstab via fuse.sshfs are not mounted after reboot

br flag

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.

mook765 avatar
cn flag
`fstab` is not a shell, `~` is not going to be expanded, use full path names in `fstab`.
fueggit avatar
br flag
Thanks! I adjusted identityfile path with a full dir, but still stuck in the same.
mook765 avatar
cn flag
Please [edit](https://askubuntu.com/posts/1477827/edit) your question accordingly with your recent fstabline.
mook765 avatar
cn flag
There is still a `~` in your fstab line `~/somedir` is not going to work.
fueggit avatar
br flag
Yeah, because with a full path directory is not found at all.
Score:0
us flag

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

fueggit avatar
br flag
Thanks, but I would rather connect only with a `identityfile` instead of a password. Just trying to identify why password is still required when I provide `identityfile` on fstab.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.