曦远 (DealiAxy)一份私人的文字刊物

StarBlog
返回文章列表折页手记阅读全文
Windows

Enable ssh-agent on Windows 11

Microsoft has so many pitfalls!!!

曦远 (DealiAxy)约 3 分钟
目录5 个章节

Introduction

I previously covered Passwordless SSH Login on Windows 10, but Windows 11 is a bit different now.

So I wrote another post.

Background

Microsoft’s current official documentation clearly states:

The ssh-agent service on Windows is Disabled by default.

So you need to un-disable it first, then start it.

Steps

In PowerShell with administrator privileges, run:

# 管理员 PowerShell
Set-Service -Name ssh-agent -StartupType Automatic
Start-Service ssh-agent

If there are no errors, it succeeded.

At this point, running ssh-add will work normally.

Forward Agent

If you want to forward the local ssh-agent to a remote server, add the -A parameter when connecting:

ssh -A user@remote-server

Or configure it in ~/.ssh/config:

Host remote-server
    HostName remote-server
    User user
    ForwardAgent yes

References