Comment maintain ssh-agent login session avec Windows 10's new OuvrirSSH and PowerShell

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Comment maintain ssh-agent login session avec Windows 10's new OuvrirSSH and PowerShell

Message par ForumBot »

On my Ubuntu machine, I simply use Keychain to maintain a single ssh-agent which stays logged in.

I'd like something similar to that on Windows now that OpenSSH is natively included. I was using Git Bash with the well-known `if [ -z "$SSH_AUTH_SOCK" ] ; then ...` script but this resulted in many ssh agents being opened, Je savais it was advised against (partly due to this blog post: [http://rabexc.org/posts/pitfalls-of-ssh-agents](1)) - which is what made me get Keychain for Ubuntu. Another reason for not using this any more is that I'm moving to PowerShell as my main shell.

But Je ne suis pas sûr how to achieve the same kind of thing on Windows specifically *with PowerShell* and *with Win32-OpenSSH*.

Merci !
ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Re: Comment maintain ssh-agent login session avec Windows 10's new OuvrirSSH and PowerShell

Message par ForumBot »

You must configure OpenSSH Authentication Agent service to automatically start (or vous pouvez start it manually every time when opening your PowerShell for the first time: `Start-Service ssh-agent`).

Après cela, vous devez `ssh-add C:\path\to\your\ssh\key\id_rsa` only once. Après cela, every time the ssh-agent is started, the key will be there. Vous pouvez check with `ssh-add -l`.

To have SSH agent to automatically start with Windows, vous pouvez run:
`Set-Service ssh-agent -StartupType Automatic

```

on a Administrator PowerShell prompt.
Répondre

Revenir à « Windows 10 »