Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'Enter PIN for authenticator' Issue related to SSH

Tags:

github

macos

ssh

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 ([email protected])

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.
like image 628
Scott Hsieh Avatar asked Sep 24 '20 09:09

Scott Hsieh


People also ask

How do I enter a passphrase for SSH?

$ ssh-keygen -p -f ~/. ssh/id_ed25519 > Enter old passphrase: [Type old passphrase] > Key has comment '[email protected]' > Enter new passphrase (empty for no passphrase): [Type new passphrase] > Enter same passphrase again: [Repeat the new passphrase] > Your identification has been saved with the new passphrase.

What is SSH authentication in GitHub?

You can connect to GitHub using the Secure Shell Protocol (SSH), which provides a secure channel over an unsecured network.

How do I get SSH credentials?

Enter your Server Address, Port Number, Username and Password as provided by your host. Click the Show Public Key button to reveal the VaultPress public key file. Copy that and add it to your server's ~/. ssh/authorized_keys file .

What is SSH-keygen passphrase?

SSH uses private/public key pairs to protect your communication with the server. SSH passphrases protect your private key from being used by someone who doesn't know the passphrase. Without a passphrase, anyone who gains access to your computer has the potential to copy your private key.


3 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
like image 146
Rohan Patil Avatar answered Oct 17 '22 05:10

Rohan Patil


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.

like image 26
Eli Avatar answered Oct 17 '22 04:10

Eli


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 ([email protected])
like image 21
Pravind Kumar Avatar answered Oct 17 '22 03:10

Pravind Kumar