using ssh-agent in cygwin

Andrey Repin
Tue Jul 20 07:24:35 GMT 2021

Greetings, Jesse Thompson!

> *TL:DR;* I'm looking for options to reliably start and manage an ssh-agent
> daemon in Cygwin.

I'm using ssh-pageant myself. But I do have a compatible wrapper for

> Using ssh-agent in cygwin seems very compelling.


> OpenSSH client config AddKeysToAgent option and ssh-agent -t option allow me
> to keep keys unlocked for limited times the way that I'd like, and unlock
> upon use instead of upon login, and avoid having to manually ssh-add.

Fine, I guess?

> But I'm left with the issue of "how can all of my shell windows use the
> same daemon" and "how can I get the daemon to start automatically without
> spawning an army of unmanaged zombies"?

> $HOME/.local/bash/.bashrc.d/ssh-agent
>> # Import ssh-pageant settings
>> test -f "$HOME/.ssh/agent" && . "$HOME/.ssh/agent"

Conveniently, add to .bashrc:

for f in "$HOME/.local/bash/.bashrc.d/"*; do
    test -f "$f" && . "$f"

> I have to assume that ssh-agent is very popular to use, and that
> copy-pasting 6-12 lines of fragile, custom bash code into one's profile
> doesn't have to be the primary way to get into this club.


> So, how do you guys manage ssh-agent? Is it really a niche solution, and
> there's some better way to get similar SSO-like benefits I should know
> about instead?

You should stop bashing into open door.

> Please advise, thanks folks!

If you want a robust solution, a small wrapper script is required.
Something like

With best regards,
Andrey Repin
Tuesday, July 20, 2021 0:09:24

Sorry for my terrible english...

More information about the Cygwin mailing list