public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Wayne Davison <wayne@opencoder.net>
To: Jesse Thompson <jesset@gmail.com>
Cc: cygwin <cygwin@cygwin.com>
Subject: Re: using ssh-agent in cygwin
Date: Mon, 19 Jul 2021 20:53:52 -0700	[thread overview]
Message-ID: <CAHSx_SsMKok0qHhF2xY6BzJREie3zjbmuzC-xUF3uPyZfFd9PQ@mail.gmail.com> (raw)
In-Reply-To: <CA+wh7KiXZFfsnk3gwbceWw3zCW3tg8g42Z8NSanas-KH2emtRQ@mail.gmail.com>

On Mon, Jul 19, 2021 at 12:44 PM Jesse Thompson wrote:
> *TL:DR;* I'm looking for options to reliably start and manage an ssh-agent
> daemon in Cygwin.

I recommend the "keychain" package, which is available in Cygwin.
You'd add something like the following to your shell initialization
scripts:

/usr/bin/keychain -q $HOME/.ssh/*_?sa
source $HOME/.keychain/$HOSTNAME-sh

This ensures that you get prompted for your key password on first
login, which unlocks all the key-file args when keychain adds them to
the ssh-agent that it starts for you. Any subsequent shells just share
the existing ssh-agent.

If you don't like that the password prompt happens at login time, you
could leave off the list of default key files and add them using
ssh-add later on.  I sometimes go this route and use a ~/bin/ssh shell
script that looks like this:

#!/bin/bash
case `ssh-add -l` in
*2048*|*1024*) ;;
*) ssh-add ~/.ssh/*_?sa ;;
esac
exec /usr/bin/ssh "${@}"

This method asks you for your key password the first time you run ssh.

..wayne..

  reply	other threads:[~2021-07-20  3:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-19 19:42 Jesse Thompson
2021-07-20  3:53 ` Wayne Davison [this message]
2021-07-20  7:24 ` Andrey Repin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHSx_SsMKok0qHhF2xY6BzJREie3zjbmuzC-xUF3uPyZfFd9PQ@mail.gmail.com \
    --to=wayne@opencoder.net \
    --cc=cygwin@cygwin.com \
    --cc=jesset@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).