I have a screen session open in an lxterminal window. If I SSH somewhere, the first time it happens, an ssh-agent window opens and asks me for my private key passphrase, and after that ssh goes right on. If I log in from outside to this machine and attach to the screen session however, ssh-agent now asks me every time I connect for my passphrase, in the terminal. Is there a way to avoid this and to let it continue using the X agent, or at least to have the non-X agent remember the passphrase?

  • You probably have to import SSH_AUTH_SOCK to the screen session Jul 2, 2013 at 14:55
  • @TobiasKienzler, Why not add your message as an answer? In any case, is there a way to prevent this variable from disappearing? When I first start the screen session in xorg there is no problem with the agent. Also, is there a way to make perhaps the agent work only via the shell instead?
    – Shwouchk
    Jul 2, 2013 at 20:51
  • 1
    I was trying to find a duplicate, but actually the question I had in mind is on unix.SE: unix.stackexchange.com/q/48993/863 The answers there should help you Jul 3, 2013 at 6:08
  • Thanks @TobiasKienzler ! Can't say it is a duplicate but there are certainly answers there that are applicable....
    – Shwouchk
    Jul 3, 2013 at 11:18

1 Answer 1


On my server ssh (out) I use Funtoo Keychain I use the funtoo keychain on my Ubuntu server. I only have to save the passphrase once per system boot.

Here is information from their site: The Funtoo "Keychain helps you to manage ssh and GPG keys in a convenient and secure manner. It acts as a frontend to ssh-agent and ssh-add, but allows you to easily have one long running ssh-agent process per system, rather than the norm of one ssh-agent per login session." Here are install instructions for Ubuntu-Debian Linux Server keychain

On my Ubuntu client using Xfce I am using Gnome Services. In order to save it I use the Ghome keyring.

  • Thanks! I voted it up because it is an interesting solution, but I somehow don't like having the key work even after complete logout from the server, so I'll be looking for another solution meanwhile.
    – Shwouchk
    Jul 3, 2013 at 11:17
  • @Shwouchk good thought. Now I am worried. I am going to have to look into that one.
    – Alliswell
    Jul 3, 2013 at 15:51
  • Do you know if there is a way to make it remember even through a reboot? See my question; OS X for instance can do this.
    – Steven Lu
    Jul 19, 2013 at 18:56
  • What's the point? You might as well just keep a non-passworded file then (and encrypt the entire / or /home/user dir, to be decrypted at boot/login)
    – Shwouchk
    Aug 25, 2013 at 12:27
  • I'm not a fan of bloating machines installing packages for everything, so I was a bit hesitant about giving keychain a go, but I have to admit I'm happy I made an exception here: keychain does a pretty damn good job at what it does, and it's super easy to set up.
    – Mahn
    Oct 26, 2013 at 19:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .