Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I want to force ssh to always use the program specified by SSH_ASKPASS. In my case the program is just a bash script returning the passphrase.

The problem is, as the ssh documentation says:

If ssh needs a passphrase, it will read the passphrase from the current terminal if it was run from a terminal.

So if I run ssh from a terminal, SSH_ASKPASS is ignored.

There is a similar question: Tell SSH to use a graphical prompt for key passphrase

which proposes create an alias for ssh, like this

$ alias ssh="setsid ssh"

but doesn't work for me, because I don't call ssh directly, is called from git or rsync.

I also found an open issue in the OpenSSH Bugzilla asking for a fix, but was opened in 2002, so I don't believe is going to be implemented.

I'm thinking on probably weird solutions:

  1. Make a fake ssh agent, which calls the script and returns the passphrase.
  2. Create a process looking for new ssh processes and detach them from the terminal before ssh asks for the password.

Any better sugestion?

share|improve this question
If I read that open issue correctly, you can set DISPLAY to some value and then SSH_ASKPASS will be used. –  npostavs Aug 12 '14 at 0:19
When working in a graphical environment DISPLAY is already set. The question is about forcing SSH to use a GUI passphrase window. I personally would also like to use a (fullscreen) GUI way to provide passphrase but the most of all I would like to provide it once, i.e. I would like to talk to the SSH agent, not to the SSH client. –  Pavel ┼áimerda Jan 31 at 16:55

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.