[Bug 2739] ssh-add no longer works with xargs

bugzilla-daemon at bugzilla.mindrot.org bugzilla-daemon at bugzilla.mindrot.org
Mon Jul 10 11:34:47 AEST 2017


https://bugzilla.mindrot.org/show_bug.cgi?id=2739

Darren Tucker <dtucker at zip.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dtucker at zip.com.au

--- Comment #1 from Darren Tucker <dtucker at zip.com.au> ---
(In reply to Micah Culpepper from comment #0)
> I have a small script in my bash profile to ensure my ssh keys have
> been added to ssh-add. A recent update broke this.

You updated from what to what?  Were the old and/or new built from
source from openssh.com?

> Here is the command I was using:
> find ~/.ssh | egrep 'id_rsa$' | xargs ssh-add -K

The ssh-add we ship does not have a '-K' option.  Where did you get
this package?

> What's weird is that this works if I don't use xargs.

What's likely happening is xargs does not pass a controlling tty. 
Normally this would result in a X-based ssh-askpass popup asking for a
password, but you don't have ssh-askpass.

$ tty
/dev/ttyp0
$ echo | xargs tty
not a tty

> The xargs approach was working before.

worked with a graphic or text prompt for passphrase?

> And in fact, I can even do it
> all on one line and it works:

works with a graphic or text prompt for passphrase?

[...]
> So:
>  - One filename at a time works.
>  - Multiple filename arguments works.
>  - Filenames coming from xargs does not work.

so use a subshell instead of xargs so you retain the controlling tty:

$ ssh-add `find ~/.ssh | egrep 'id_rsa$'`

(or if you don't like old-school backticks):

$ ssh-add $(find ~/.ssh | egrep 'id_rsa$')

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.


More information about the openssh-bugs mailing list