Windows 2022
Sponsored Link

OpenSSH : Use SSH-Agent2021/12/01

Use SSH-Agent to automate inputting passphrase on key-pair authentication.
[1] SSH-Agent is installed by default with OpenSSH Client programs, however, it is disabled by default, so turn to enabled and also Start the service.
Copyright (C) Microsoft Corporation. All rights reserved.

PS C:\Users\Administrator> Get-Service ssh-agent 

Status   Name               DisplayName
------   ----               -----------
Stopped  ssh-agent          OpenSSH Authentication Agent

# set [Automatic] for Startup
PS C:\Users\Administrator> Set-Service -Name "ssh-agent" -StartupType Automatic 

# start service
PS C:\Users\Administrator> Start-Service -Name "ssh-agent" 
[2] Logon as a user that you set SSH key-pair, and add secret key like follows.
Copyright (C) Microsoft Corporation. All rights reserved.

# add passphrase
PS C:\Users\serverworld> ssh-add '.ssh\id_rsa' 
Enter passphrase for .ssh\id_rsa:
Identity added: .ssh\id_rsa (serverworld@RX-7)

# verify
PS C:\Users\serverworld> ssh-add -l 
3072 SHA256:mOyrz2MfAghFfjgBsnPVhFR3rDC3rtWbrz6kNc/2/DQ serverworld@RX-7 (RSA)

# try to conenct wuthout inputting passphrase
PS C:\Users\serverworld> ssh Serverworld@ 

Microsoft Windows [Version 10.0.20348.350]
(c) Microsoft Corporation. All rights reserved.

serverworld@RX-7 C:\Users\serverworld> 
serverworld@RX-7 C:\Users\serverworld> exit 

# remove all identities
# if remove a specific identity, specify [-d] option
PS C:\Users\serverworld> ssh-add -D 
All identities removed.
Matched Content