3

I have added a following line in fstab:

sshfs#root@1.2.3.4:/root/dir /home/dir fuse.sshfs defaults,_netdev 0 0

When I try to mount it with mount -a, I get a password request, even though I've added id_rsa.pub of root to authorized_keys of the server to connect to, and when I run ssh root@1.2.3.4 as root, I don't get asked for password.

Also, when I run:

sudo sshfs -o allow_other root@1.2.3.4:/root/dir /home/dir

It connects fine. I'm doing this as root user, so the problem obviously isn't that ssh runs as root, but ssh key is of some user.

Why doesn't sshfs use the key?

  • Title says does not request password, body says does. Can you fix the question to make it clear. – ctrl-alt-delor Jun 5 '16 at 11:22
  • @richard, sorry, indeed, the title was wrong. Thanks – Fluffy Jun 5 '16 at 11:29
  • 1
    This should not be closed as "can't be reproduced". The question clearly shows the sshfs# prefix (which the answer states is the issue). Prefixing the line with sshfs# is common for fuse mounts, and is in numerous documents on the web: goo.gl/b1d6Gd goo.gl/ilhqjw – Patrick Jun 9 '16 at 4:42
  • @Patrick: Well, I guess they closed it because the problem "went away when a typo was fixed". My understanding of that close reason is that it's meant for monumentally stupid typos, like "Why is the system saying muont not found?" I believe that this solution to this problem is likely to help future readers, so I'm voting to reopen. – G-Man Jun 9 '16 at 5:20
2

The problem was with the sshfs# part in fstab, apparently it's passed to ssh as-is, and it presumably searches for id_rsa of that missing user. After I've removed sshfs# it worked fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.