Questions tagged [ssh-agent]

SSH-agent is an utility which offers a secure way of storing the passphrase of the private key used in SSH connections

158 questions
92
votes
2 answers

How do I clear out the ssh-agent entries (on Mac OS X )?

I'm running Mac OS X, and it appears that after SSHing to several machines, using identity files, my 'ssh-agent' builds up a lot of identity / keys and then sometimes offers too many to a remote machine, causing them to kick me off before…
cwd
  • 17,668
  • 42
  • 121
  • 159
81
votes
4 answers

How to make ssh-agent automatically add the key on demand?

I want to run ssh-agent (with maximum lifetime option), but not add any keys at startup, but instead add them on demand. Like first time I login to some server it should ask for passphrase, next time (unless I waited for more than a hour) it should…
Vi.
  • 16,755
  • 32
  • 111
  • 189
77
votes
20 answers

Sharing the same `ssh-agent` among multiple login sessions

Is there a convenient way to ensure that all logins from a given user (ie me) use the same ssh-agent? I hacked out a script to make this work most of the time, but I suspected all along that there was some way to do it that I had just missed. …
intuited
  • 3,291
  • 7
  • 30
  • 40
57
votes
13 answers

How do you get screen to automatically connect to the current ssh-agent when re-attaching to an existing screen?

If you start a screen session while ssh-agent is running (from ssh -A agent forwarding), accessing ssh-agent works fine. However, if you detach from that session, log out, log in again (with ssh-agent forwarding), and re-attach to your screen…
apinstein
39
votes
6 answers

How can I forward a gpg key via ssh-agent?

I can use the ssh configuration file to enable the forwarding of ssh keys added to ssh-agent. How can I do the same with gpg keys?
txwikinger
  • 2,667
  • 2
  • 21
  • 17
39
votes
2 answers

Save identities added by ssh-add so they persist

I recently setup openssh so I could use it with git. In the process of setting it up (as per this article) I ran the commands: $ eval "$(ssh-agent -s)" $ ssh-add ~/.ssh/ Some time later, after I logged out and back in I tried to use…
timotree
  • 1,078
  • 1
  • 9
  • 22
32
votes
9 answers

ssh: Error loading key "./id_rsa": invalid format

For some reason one of my ssh keys "just broke" - it just stopped working: $ ssh-add ./id_rsa Error loading key "./id_rsa": invalid format Copying the key inside a clean VM, the key does work. Even with the exact same ssh version (OpenSSH_7.8p1,…
FlorianLudwig
  • 423
  • 1
  • 4
  • 6
23
votes
2 answers

Extra configuration required for ssh-agent forwarding?

This guide does a great job explaining how ssh-agent works across multiple systems. I'd like to get forwarding set up as it is in the last set of diagrams, but I'm having trouble tracking down the steps required to do so. For some machines on my…
Coderer
  • 1,578
  • 5
  • 19
  • 31
22
votes
3 answers

ssh-agent / ssh-add error: could not open a connection to your authentication agent

I type in ssh-agent and get the following back: SSH_AUTH_SOCK=/tmp/ssh-GqdeT074HLRJ/agent.4670; export SSH_AUTH_SOCK; SSH_AGENT_ID=4671; export SSH_AGENT_PID; echo Agent pid 4671; I then type in ssh-add privkey.pem and get the following: Could not…
neubert
  • 6,863
  • 35
  • 76
  • 138
22
votes
7 answers

How to use SSH private key to log in without entering passphrase every time on Mac OS X Lion?

I use Mac OS X Lion and login remote hosts via SSH every day. Despite the fact that I use SSH key pair for remote authentication and I don't need to motorize every host's login phrase, it is still very annoying that the terminal asks for the…
Jianwen W.
  • 453
  • 1
  • 3
  • 8
22
votes
3 answers

Use a specified key from ssh-agent

Along the lines of How to tell git which private key to use? I would like to use a specific ssh key in a given situation. My problem is that even when I specify '-i something' ssh uses the keys from my ssh-agent in the order they are added. My…
svrist
  • 755
  • 2
  • 9
  • 10
21
votes
1 answer

Using the IdentityFile directive in ssh_config when AgentForwarding is in use

Is it possible to specify forwarded keys using the IdentityFile directive in .ssh/config? I ran into this quirk when trying to deploy some code via Capistrano/GIT on our production server. Both my personal and my work GIT keys are always loaded in…
skryl
  • 355
  • 2
  • 7
19
votes
2 answers

Can't remove keys from ssh-agent. Even rebooting doesn't help

A short time ago I noticed that there were three keys in my ssh-agent that I could not delete. ssh-add -l showed three keys; I ran ssh-add -D, and was told "All identities removed."; but then an immediate ssh-add -l showed the same three keys. If I…
Sean
  • 1,734
  • 2
  • 15
  • 15
18
votes
1 answer

Silence ssh-add

I have a cronjob that runs some tasks, and at the beginning of the script it runs is an ssh-add call ( it doesn't run as the user with the appropriate key so it needs adding, and in future it may well use a deploy key defined in version control ).…
Tom J Nowell
  • 487
  • 1
  • 8
  • 17
18
votes
7 answers

How can I get ssh-agent working over ssh and in tmux (on OS X)?

I have a private key set up for my github account, the passphrase to which is, I believe, stored in OS X's keychain. I certainly don't have to type it in when I open a terminal window and enter ssh git@github.com. However, when I'm running bash over…
Rich
  • 2,220
  • 2
  • 18
  • 26
1
2 3
10 11