using ssh-add unattended on dubious files -- how can i avoid a hang?

Jim Knoble jmknoble at pobox.com
Thu Aug 21 08:27:59 EST 2008


Circa 2008-08-20 18:08 dixit Daniel Kahn Gillmor:

: I need ssh-add to fail cleanly if it tries and fails to read a key,
: rather than prompting the user.  I can't seem to figure out how to do
: that.

  [...]

: However, even with all that, if i feed ssh-add a garbage key as a
: subprocess of anything that as a controlling terminal, it opens
: /dev/tty and prompts for a passphrase for the key directly there.

Have you tried running ssh-add via setsid(1)?  According to setsid(2)
(used by setsid(1)):

       setsid()  creates a new session if the calling process is not a
       process group leader.  The calling process is the leader of  the
       new session, the  process group leader of the new process group,
       and has no controlling tty. [...]

--jim

-- 
jim knoble  |  jmknoble at pobox.com  |  http://www.pobox.com/~jmknoble/
(GnuPG key ID: C6F31FFA  >>>>>>  http://www.pobox.com/~jmknoble/keys/ )
(GnuPG fingerprint: 99D8:1D89:8C66:08B5:5C34::5527:A543:8C33:C6F3:1FFA)
+----------------------------------------------------------------------+
|[L]iberty, as we all know, cannot flourish in a country that is perma-|
| nently on a war footing, or even a near-war footing.  --Aldous Huxley|
+----------------------------------------------------------------------+


More information about the openssh-unix-dev mailing list