sshfs icon indicating copy to clipboard operation
sshfs copied to clipboard

sshfs not mounting when using GPG auth key on YubiKey

Open duncan-bayne opened this issue 2 years ago • 3 comments

Firstly, thanks for sshfs :)

If I ssh into my server, it works:

$ ssh dev.home
___________________________
< You have no real enemies. >
 ---------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
~ $

If I try mounting my home directory via sshfs, it fails:

 $ sudo sshfs -v -o allow_other,default_permissions [email protected]:/home/duncan ~/dev/
[email protected]: Permission denied (publickey).

Pretty sure this has something to do with the fact that my SSH auth is happening via my GPG auth key, which lives on my YubiKey 5 Nano.

Versions of things:

  • SSHFS version 3.7.1
  • FUSE library version 3.10.5
  • using FUSE kernel interface version 7.31
  • fusermount3 version: 3.10.5
  • YubiKey 5 Nano
  • gpg (GnuPG) 2.2.27
  • libgcrypt 1.9.4

I appreciate that I'll need to raise a PR to fix this myself, but wanted to raise the issue first.

duncan-bayne avatar Dec 03 '23 10:12 duncan-bayne

What have you got in your ~/.ssh/config file?

Sometimes if you don't specifically define the SSH key via identityfile /path/to/key, it will try to authenticate using all keys on your system and then SSH will fail on too many attempts before it reaches your correct key (see https://superuser.com/questions/268776/how-do-i-configure-ssh-so-it-doesnt-try-all-the-identity-files-automatically)

Or, since you're using yubikeys you might have a agent socket setup that isn't defined in ssh config?

h4sh5 avatar Dec 27 '23 22:12 h4sh5

Currently I have:

SSH_AUTH_SOCK=/run/user/1000/gnupg/S.gpg-agent.ssh

... set in my environment variables. Should that do it?

duncan-bayne avatar Jan 06 '24 02:01 duncan-bayne