0

On linux (Fedora) using bash, I have setup the GnuPG gpg-agent to act as the ssh-agent successfully. When authenticating over ssh, the agent tries the gpg keys first then falls back to the ssh keyfile ~/.ssh/id_rsa. Is there a way to reverse the order of tried keys?

My preference is to try ~/.ssh/id_rsa first, then to try gpg keys in the order specified in ~/.gnupg/sshcontrol.

I don't want to prevent gpg keys from being used so adding IdentitiesOnly yes to ~/.ssh/sshconfig does not seem like an option.

Also, I trust the security of my ~/.ssh directory and do not want to be asked for a password when using the ssh key, so using ssh-add to import the key into GnuPG is not the answer either becuase it requires a password.

  • 1
    Check the "Remember password in gnome-keyring" box in GnuPG, and you won't be asked for the password anymore? – grawity Jun 19 '18 at 21:30
  • @grawity While this is a valid answer when using Gnome, I'd prefer not to add to my already long list of password managers - especially one that is tied to a specific desktop or that requires a window manager in general. – Johann Jun 20 '18 at 14:05

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.