# Ubuntu – ssh-agent is not used when ssh is launched from panel launcher (via gnome-terminal –command)

sshssh-agentxfce-panel

I have everything set up so that after I log in and add proper identity to ssh-agent using ssh-add from a gnome-terminal window, I do not have to enter the passphrase again when I invoke ssh myserver.

Now I wanted to make it even easier and create a panel launcher that would run

gnome-terminal --command "ssh myserver"


but while this does invoke what I want, it ignores ssh-agent, i.e. it asks for pass-phrase. And it does so every time, even if I supply the PP, the next time it asks again.

What am I doing wrong? Can anybody explain why this does not work?

Further notes:

• Running gnome-terminal --command "ssh myserver from already open terminal works OK

• Changing ssh myserver part to bash -c "ssh myserver" with proper quoting
did not help.

• Also using ssh myserver right in the launcher did not help: the pass-phrase prompt
was displayed as a simple GUI window (unless I checked "Run in terminal" option,
in which case the behavior was same as described above)

• It's Ubuntu 12.04

• adding -vvv to both ssh command, here is where the failing (and asking for PP) ssh
starts to differ from the successful ssh:

[...]
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: read PEM private key done: type <unknown>
Enter passphrase for key '/home/lennycz/.ssh/id_rsa':


while the successful ssh says

[...]
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentication succeeded (publickey).
[...]


(and then lot of things apparently unrelated…)

I haven't found any helpful debug messages around nor anything in system/auth logs.

I assume you followed the linked article and modified your ~/.bashrc. However ~/.bashrc might never be sourced when you're running a command from a panel launcher.
An easy way to debug is adding date > /tmp/bashrc_sourced to then end of your ~/.bashrc and check if the current time is printed to the file when you invoke the panel launcher.