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 doesn't runs ssh-agent, it only needs an "ssh-add" per boot. But issuing an "ssh-add" on the "bad desktop" only gives an error message: "Could not open a connection to your authentication agent."
UPDATE #2: SSH_AUTH_SOCK is missing after a fresh reboot, maybe that is the problem?:
[user@notebook ~]$ env | grep SSH
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
[user@notebook ~]$
Best Answer
ssh-add
andssh
refer to a couple of environment variables to find the SSH agent to talk to:SSH_AGENT_PID
andSSH_AUTH_SOCK
. When you runssh-agent
outputs the values and your shell interprets them; they are set in the shell the command is run from, and that shell only. Thus when you start a new terminal, the new shell in that terminal doesn't have those variables set appropriately andssh
can't find the agent.If you have both terminals running, you can run
in the terminal you started the agent from, and set the values given in the new terminal. Then
ssh
should find the agent in the second terminal.A better solution though is to use the SSH agent integration in GNOME, as provided by
gnome-keyring
. I'm not sure how things are set up in RHEL Desktop, but you can try simply runningssh-add
without starting the agent beforehand...The GNOME keyring SSH documentation may be helpful; in particular, you may want to check whether the SSH Key Agent is enabled in your startup applications (in the GNOME properties).