libfuse / sshfs

A network filesystem client to connect to SSH servers
GNU General Public License v2.0
5.93k stars 496 forks source link

sshfs not mounting when using GPG auth key on YubiKey #287

Open duncan-bayne opened 10 months ago

duncan-bayne commented 10 months ago

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 duncan@dev.home:/home/duncan ~/dev/
duncan@dev.home: 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:

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

h4sh5 commented 9 months ago

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?

duncan-bayne commented 9 months ago

Currently I have:

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

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