[PATCH] ssh-add: support parser-friendly operation
Damien Miller
djm at mindrot.org
Mon Jan 13 14:58:11 AEDT 2025
On Fri, 10 Jan 2025, Corey Hickey wrote:
> On 2025-01-10 01:35, Jochen Bern wrote:
> > On 10.01.25 00:33, Corey Hickey wrote:
> > > I took the approach of preserving current behavior by default, but
> > > another approach would be to:
> > > * print "The agent has no identities." to stderr instead of stdout
> > > * exit with a status of 0 instead of 1
> >
> > Please don't. If you want to ever get people to load their privkeys into
> > the agent *with a limited lifetime*, having a trivial, *universal* way
> > to check whether they have expired by now is an asset.
> >
> > > workplace$ egrep ' ssh(|add)=' .bashrc
> > > alias sshadd='( echo -n "`tput dim`" ; ssh-add -c -t 1800 ; echo -n "`tput
> > > sgr0`" )'
> > > alias ssh='ssh-add -l >/dev/null || sshadd ; ssh'
>
> With my patch v2, that would need to be:
>
> > alias ssh='ssh-add -l | grep -q . || sshadd ; ssh'
>
> ...though the message "The agent has no identities." would be printed to
> stderr, for better or for worse. Perhaps that should require a higher
> log_level (via -v).
Are you aware of ssh's AddKeysToAgent option? It seems to already do
what you're trying to implement here.
-d
More information about the openssh-unix-dev
mailing list