Keychain for ssh-add [closed]
Asked Answered
E

3

10

I need to pull from Github all the time and I have a passphrase, but it's a pain, so I typically run...

ssh-agent bash
ssh-add ~/.ssh/id_rsa
<prompt and give passphrase>

And that works for the session, but even after I logout, I would like it to save the passphrase next time I PuTTY in. So I installed keychain, but I'm too dumb to operate it. I tried this...

/usr/bin/keychain ~/.ssh/id_dsa

And it said it added my passphrase, but it didn't work :(

How would I call keychain so it saves my passphrase for Git?

Edit: Apologies for posting this on stackoverflow, it technically does have some relevance to programming as it has to do with Git, but my apologies for not posting it on SuperUser.

Entryway answered 16/5, 2012 at 16:1 Comment(3)
Sorry, not a programming question, voting to move to superuser.com OR you can 'flag' it and ask for a moderator to move i. (I didn't downvote your question). Good luck.Macdonell
@shellter, I accidentally flagged your comment as off-topic. I'd actually meant to flag the OPs question for migration to SuperUser. There doesn't seem to be a way to unflag a mistaken comment flag--sorry.Geanticlinal
It will work if I type in "ssh-agent bash" after login, then it loads keychain with the proper key. How do I make it so I need to type nothing?Entryway
E
9

Okay this is the best I could come up with...

Install keychain...

Then add the following to ~/.bashrc file:

eval `keychain --eval id_rsa`

THEN add the following to ~/.bash_profile:

ssh-agent bash

That will start keychain. It isn't as simple as just putting both in the bash profile or bashrc file.

Entryway answered 17/5, 2012 at 13:25 Comment(0)
G
14

You actually need to invoke keychain differently. Add the following to your ~/.bashrc file:

eval `keychain --eval id_rsa`

See the keychain documentation for more information about how to set it up properly for your specific shell or system, or if you have more complex requirements.

Geanticlinal answered 16/5, 2012 at 19:42 Comment(0)
E
9

Okay this is the best I could come up with...

Install keychain...

Then add the following to ~/.bashrc file:

eval `keychain --eval id_rsa`

THEN add the following to ~/.bash_profile:

ssh-agent bash

That will start keychain. It isn't as simple as just putting both in the bash profile or bashrc file.

Entryway answered 17/5, 2012 at 13:25 Comment(0)
T
1

You have to keep the keys in a "persistent" state so to say. This can be done by having an agent open one on the local side, combined with — in case of openssh — ssh -A. Then, ssh-add on the remote server will cause the keys to be opened and retained on the local desktop, such that, when logging in again on the remote side, the keys are already available.

Tallbott answered 16/5, 2012 at 16:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.