Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The ssh-agent X app is irritating. I use a password manager and long random passwords. The password manager (pwsafe) puts the password into the clipboard (using secure ram), so it isn't displayed or typed.

However the ssh-agent X app doesn't allow me to paste a password, and it doesn't allow me to focus a terminal to launch pwsafe either.

I can work around this by doing ssh-add .ssh/key first, but that makes me have to remember what key I need.

How I can tell ssh-agent just to use the terminal? I tried unsetting DISPLAY, but that didn't do the trick.

share|improve this question
Why do you need multiple ssh keys in the first place? Use one key, and append its public part to .ssh/authorized_keys on every machine you need access to. – krlmlr Mar 11 '12 at 0:37
If you unset DISPLAY, yet ssh-agent still managed to draw to your X server, then something is very wrong. How could ssh-agent know which display to connect to if there were no DISPLAY variable? Try this command (all on one line): unset DISPLAY; ssh-agent – Fran May 21 '12 at 17:17
@Fran: thanks for pointing that out. My ssh-agent is already running, so unsetting DISPLAY in the terminal where I'm running ssh is indeed pointless. See: Usually, the ssh-agent program is a program that starts up before starting X windows and in turn starts X windows for you. All X windows programs inherit a connection back to the ssh-agent. I would have to modify my config to start ssh-agent differently. – Jean Jordaan May 23 '12 at 6:02
@JeanJordaan Yes, you are right. ssh-agent and ssh-add are being executed for you by the default X windows login processing scripts. If you read those scripts, you may find a way to disable the invocation of ssh-add (since no terminal is open yet). Then you can have your ~/.bashrc script test for the existence of added keys (see the -l option to ssh-add) and run ssh-add if none have been added yet. Since that will happen in a terminal then you will be prompted in the terminal (according to the ssh-add man page). – Fran May 23 '12 at 16:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.