Questions tagged [ssh-agent]

ssh-agent is a single sign-on mechanism for SSH that is included in the OpenSSH software. Use this tag for questions on how to configure and use ssh-agent.

An alternative to -based authentication is . In essence, with public-key authentication one proves the identity by signing a challenge using the private key. Assuming that

  • the verification of the signature succeeds
  • the digital signature scheme is secure
  • the private key is indeed private
  • an authentic copy of the corresponding public key is available

this proves the identity.

The third point is essential. In order to protect private keys from leaking out, they are often locked with a password (or passphrase). In order to unlock and use them, the user has to enter that password. follows the same pattern.

Since this procedure is not very user friendly, single sign-on was invented. The basic idea is that a user authenticates once and all further authentication happens automagically. For SSH (more precisely, the OpenSSH implementation) this magic is performed by the ssh-agent which stores the passphrase in memory and automates SSH public-key authentication.

Beware: By default, once started, ssh-agent keeps your passphrases indefinitely. In particular, ssh-agent does not terminate upon session exit. A more secure approach is to let ssh-agent "forget" passphrases after a while.

272 questions
30
votes
4 answers

How to restart ssh-agent without relogin

I accidentally killed my ssh-agent, how do I restart it without having to reconnect ? I tried this but it does not work : $ eval $(ssh-agent -s) Agent pid 8055 Then, I open a new Gnome terminal with CTRL+SHIFT+N from the previous terminal window…
SebMa
  • 2,149
6
votes
2 answers

`ssh-agent` asks passphrase after it has been added

I'm new to the ssh-agent and encounter what I identify as a "bug". Situation I have a passphrase-protected private key. I want to use the ssh-agent so I do not write the passphrase each time I ssh. ssh-agent adds the private key (according to…
Auzias
  • 173
5
votes
3 answers

ssh-add is forgotten if new gnome-terminal is opened

After a: eval `ssh-agent -s` ssh-add I can log in to a "server" via ssh without pwd. Question: But If I open a new gnome-terminal I have to do this again, why? Using RHEL Desktop 6.6 with GNOME. UPDATE #1: interesting, another RHEL Desktop…
3
votes
1 answer

Too many keys being added to ssh-agent in CentOS6 - how can I stop this?

I was trying to debug an ssh problem Too many authentication failures, and find with ssh -vv that ssh is presenting lots of keys before falling back to try a password. On investigation I find that these keys are added somehow with ssh-agent running…
2
votes
1 answer

How to speed up ssh-agent?

I use ssh to log into many servers. When running a script that does this, ssh-agent uses 100% CPU time. For small tasks on many servers ssh-agent is now the bottleneck. Is there anything I can do to speed up ssh-agent? Can it be told to fork off a…
Ole Tange
  • 35,514
1
vote
2 answers

ssh-agent: how it works?

I want to try the ssh-agent to login without password (I already know gssapi and pubkey methods, but I want to learn this). On client and server I had enabled AgentForward on ssh_config (client) and sshd_config (server) On client, I start…
elbarna
  • 12,695
1
vote
0 answers

ssh-add is missing the argument -A to load all keys at once

For the past years after a reboot I used to run ssh-add -A that loaded all my keys ( the previously i've added with -k ) back to the agent. But now I received a new laptop ( MacOSX Monterey ) and the -A is missing. I cannot find any other argument…
1
vote
0 answers

Why do I need to start ssh-agent twice?

I'm on a Raspberry running Raspbian GNU/Linux 11 (bullseye). Im stuck with a strange behaviour. After booting, ps -ef | grep ssh says root 482 1 0 16:03 ? 00:00:00 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups pi …
fbstov
  • 9
1
vote
1 answer

ssh-add without prompt

I am working on some shell and I encountered the following line: cat /ssh/sshkey | tr -d '\r' | ssh-add - This code get a key and add it to an agent. This work on its current environment, but when I try it on another VM, I get the following: Error…
1
vote
0 answers

ssh-agent is evoluting on it's own

From my point of view the only config I had, was line ssh-add -k in my .bashrc and it was working. I.e. I was able to do ssh -A and was seeing my key with ssh-add -l on remote hosts. Suddenly this line started to cause Error connecting to agent:…
Dims
  • 3,255
1
vote
0 answers

ssh-agent terminating on network change

My work computer is a painfully out of date Ubuntu 16.04 machine. I have it configured such that that lightdm invokes ssh-agent (not gnome-keyring-daemon) and ssh-agent invokes my session. This is not too dissimilar to how I have my personal laptop…
Huckle
  • 1,005
0
votes
1 answer

configuring ssh-agent

I'm using ssh-agent for caching private keys; it's working well before connecting remote PC its not asking for a PASSPHRASE but its asking remote user password. Ex: host$ sudo ssh-agent bash sudo ssh localhost2.localdomain after that its…