'Enter PIN for authenticator' Issue related to SSH

Viewed 43366

Brief

I attempted to generate a SSH key for my Github on a Macbook Pro. Yet I encountered the 'Enter PIN for authenticator' issue when I progressed to the step of adding it to the ssh-agent. The bizarre asking is from the following command:

$ ssh-add -K ~/.ssh/id_rsa
Enter PIN for authenticator:

which I totally have no idea what I should type into for this asking. Yet as I typed with the following command, everything just worked as this page revealed.

$ /usr/bin/ssh-add -K ~/.ssh/id_rsa
Identity added: /Users/${user_name}/.ssh/id_rsa (your_email@example.com)

Why there exists this kind of difference ? What exactly you need to type for the asking of 'Enter PIN for authenticator:' ?

Some Info

  1. version information
$ ssh -V
OpenSSH_8.3p1, OpenSSL 1.1.1g  21 Apr 2020

$ sw_vers -productVersion
10.15.6
  1. I generated the key with the ed25519 algorithm.
4 Answers

If you use this command

$ ssh-add -K ~/.ssh/id_rsa 

you will be asked to enter the PIN for authentication so instead of that use

$ ssh-add ~/.ssh/id_rsa

You have a second (Brew-installed?) ssh-add in your shell's $PATH which is not the same as the Apple version. In the Apple version -K stores the password in your keychain, so you don't have to type it every time. In the non-Apple version -K "Loads resident keys from a FIDO authenticator."

The ssh-add at:

/usr/bin/ssh-add

is the Apple provided one, and will work with -K.

Update for macOS Monterey (v12)

The -K and -A flags are deprecated and have been replaced by the --apple-use-keychain and --apple-load-keychain flags, respectively.

I have seen on - https://www.ssh.com/academy/ssh/add and found that if we use -'k' (small k) then it is asking about passpharase what I added during ssh key generaion.

for instance my passphrase while creating ssh key was - Pass@123# after that when i exeute command -

$ssh-add -k ~/.ssh/id_rsa 
Enter passphrase for ~/.ssh/id_rsa: (typed here - Pass@123# and press enter)
Identity added: ~/.ssh/id_rsa (xxxxxxx@xxxx.com)

as specified by the man ssh-add page, the -K option is:

-K Load resident keys from a FIDO authenticator.

so you basically tell it to use an authenticator.

Related