Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Steps

  1. Open PuTTY on my Windows desktop.
  2. SSH into my MacBook Pro.
  3. cd to a github clone
  4. $ git push

Expected

Everything up-to-date

Actual

Enter passphrase for key '/Users/whit537/.ssh/github':

Notes

  • The github key is listed in Keychain Access.
  • I can show its passphrase in Keychain Access.
  • I can use this passphrase successfully at the prompt in PuTTY.
  • I get the expected result at a Terminal window on the MacBook.
  • uname -a: Darwin chad.whitacre 10.7.0 Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386 i386

Updates

2011-04-12: I discovered the security tool via a question in the Related sidebar (didn't notice it in the list of possible answers when posting). I tried running security unlock-keychain but I get the same result. It seems as though there should be some way to do this. There are two keys in question, actually, and these are long passphrases, not short passwords, and I need them frequently during the day. So I have some incentive to get to the bottom of this.

2011-04-13: This sounds promising. I see the /tmp/launch-*****/Listeners file on the MacBook. Next time I am on the PC I'll try setting SSH_AUTH_SOCK in my PuTTY session. If that works once I'll see about a .profile hook to discover the current launch session automatically.

share|improve this question

3 Answers 3

You should be able to unlock your keychain in the Terminal like this:

security unlock-keychain -p <YourPassword> ~/Library/Keychains/login.keychain

If you do not want to be prompted for the password you can store the password in a file and then execute the command like this:

security unlock-keychain -p `cat ~/.file_with_your_password` ~/Library/Keychains/login.keychain

Please note that storing your keychain password in a file has some security-related drawbacks as you can imagine so you have to decide for yourself if this is an option for you.

I Hope this helps

share|improve this answer
    
"some" indeed, doesn't putting the password to access your keychain in plaintext in a file kinda make the whole thing pointless...? Then you could as well have the stuff that is protected in the keychain in plaintext, too? –  tml Dec 12 '12 at 12:18

Your keychain is tied to the graphical login of OS X. When you log in to the computer locally it opens your keychain. Terminal, with bash running inside it, is aware of your keychain.

When you log in remotely through PuTTY your keychain doesn't get opened, and PuTTY and bash do not know of it - even if you are logged in locally as well. The link between them just isn't there.

So I'm sorry, but when you log in through PuTTY you are stuck with having to enter the password.

That is unless someone who knows the internals of the OS X keychain system can come up with some way to manually put that link in place within your PuTTY connected session, but that to my mind is probably more work than typing in a password once in a while.

share|improve this answer
    
These are long passphrases for a couple keys that I use frequently, so I have some incentive to discover the linking mechanism of which you speak. –  whit537 Apr 13 '11 at 17:41

As I describe in this answer, you need to also run

eval `ssh-agent -s`

in addition to unlocking the keychain.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.