MacOS Sierra not properly accessing keychain passphrases for SSH/OpenSSL

Hi,


There seems to be a problem in MacOS Sierra regarding the passphrases for SSH keys.


I have my public/private keypair enabled for accessing some linux servers, so I can SSH into them without inserting my passwords. After the upgrade to macOS sierra, it seems that the keychain is no longer processing/storing/retrieving the passphrases properly.


When first tried to login into one of my remote servers, I was asked for the passphrase, which seemed weird, so I thought that perhaps the passphrases were lost in the upgrade and changed the passphrase manually by invoking "ssh-keygen -f id_rsa -p". Then I proceeded to login again, I was asked for the passphrase and entered it, so I could login into the server, but then, regardless of SSH telling me that it has stored the new passphrase in the keychain, following attempts to login again always ask me for the passphrase.


debug1: Next authentication method: publickey debug1: Offering RSA public key: /Users/xxxxx/.ssh/id_rsa.pub debug3: send_pubkey_test debug3: send packet: type 50 debug2: we sent a publickey packet, wait for reply debug3: receive packet: type 60 debug1: Server accepts key: pkalg ssh-rsa blen 535 debug2: input_userauth_pk_ok: fp SHA256:/xxxxxxxxx/GM debug3: sign_and_send_pubkey: RSA SHA256:/xxxxxxxx/GM debug3: Search for item with query: { acct = "/Users/xxxxx/.ssh/id_rsa.pub"; agrp = "com.apple.ssh.passphrases"; class = genp; labl = "SSH: /Users/xxxxx/.ssh/id_rsa.pub"; nleg = 1; "r_Data" = 1; svce = OpenSSH; } debug2: Passphrase not found in the keychain. Enter passphrase for key '/Users/xxxxx/.ssh/id_rsa.pub': debug2: no passphrase given, try next key debug1: Offering RSA public key: /Users/xxxxx/.ssh/id_rsa debug3: send_pubkey_test ... debug2: storing passphrase in keychain debug3: Search for existing item with query: { acct = "/Users/xxxxx/.ssh/id_rsa"; agrp = "com.apple.ssh.passphrases"; class = genp; labl = "SSH: /Users/xxxxx/.ssh/id_rsa"; nleg = 1; "r_Ref" = 1; svce = OpenSSH; } debug3: Item already exists in the keychain, updating. debug3: send packet: type 50 debug3: receive packet: type 52 debug1: Authentication succeeded (publickey).


Please note how it fails to find the passphrase in the keychain (this is the second and following attempts' output), then it says that it stores the passphrase in the keychain, and then it finds it and "updates" it. However, next attempt will not find the passphrase in the keychain, so the process will repeat "ad nauseam".

MacBook Pro (Retina, 13-inch,Early 2015), macOS Sierra

Posted on Sep 15, 2016 1:19 AM

Reply
19 replies

Oct 7, 2016 1:53 PM in response to Arnasio

I've already managed to fix this problem my self


all you need to do is the following:


open "Keychain Access"

then from "login" keychains locate "SSH: /Users/yourusername/.ssh/id_rsa

then right click and copy password to clipboard, unfortunately i found the password to be 'roott' and that is not a password that i ever used, seems like the new upgrade shipped with this passphrase


but then i used that passphrase to get my password-less ssh hosts to work


if you want to fix it for later use, just edit the password to match your Mac session password


hope it helps

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

MacOS Sierra not properly accessing keychain passphrases for SSH/OpenSSL

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.