I've created the following RSA key (with passphrase):

ssh-keygen -t rsa -f rsa_foo

Now when adding the key in normal way, ssh-add asks for the passphrase fine:

$ ssh-add rsa_foo
Enter passphrase for rsa_foo: 12345

However when I'm loading the key through FIFO, it doesn't ask anymore:

$ mkfifo -m=600 fifo
$ cat rsa_foo >fifo | ssh-add fifo

and it gives me the following error instead:

  • OS X:

    ssh_askpass: exec(/usr/libexec/ssh-askpass): No such file or directory

  • Linux (Ubuntu):

    ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory

This works when RSA key file doesn't have passphrase.

How do I fix the above error in order so ssh-add can ask the passphrase normally (or I could pass to it somehow)?

My goal is to load this RSA key using FIFO.

1 Answer 1


It does ask me for the password:

$ ls -l fifo
prw------- 1 glopes users 0 Out 11 03:59 fifo
$ ssh-add fifo
Enter passphrase for fifo:

Then load the key from another terminal:

$ cat id_rsa > fifo

Or try the following one-liner:

$ (cat id_rsa > fifo &); ssh-add fifo

Right on the terminal, without calling $SSH_ASKPASS, like the manual says:

If ssh-add needs a passphrase, it will read the passphrase from the current terminal if it was run from a terminal. If ssh-add does not have a terminal associated with it but DISPLAY and SSH_ASKPASS are set, it will execute the program specified by SSH_ASKPASS (by default ``ssh-askpass)'' and open an X11 window to read the passphrase.

You can always work around it by decrypting the key explicitly before passing it to ssh-add.

  • @kenorb Just cat id_rsa > fifo from another terminal.
    – Artefacto
    Oct 11, 2015 at 15:51

You must log in to answer this question.

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