When I SSH into OS X, I don't have my keychain. When I use Terminal, I do

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


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.


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

eval `ssh-agent -s`

in addition to unlocking the keychain.