Windows 10 上的 ssh 代理程式轉發

Windows 10 上的 ssh 代理程式轉發

當我從已啟用的 macOS 用戶端透過 sshAgentForwarding連線到 Windows 10 主機時,我無法存取主機上的用戶端金鑰。

Windows主機內建OpenSSH伺服器已AllowAgentForwarding啟用。

此外,當我 ssh 到其他(非 Windows)主機時,代理轉送可以正常運作。

我是否缺少一些特殊技巧來讓代理轉發在 Windows 主機上工作,或者是什麼可能導致它無法運作。

調試日誌至少似乎表明它正在嘗試連接代理:

debug1: active: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug1: server_input_channel_req: channel 0 request auth-agent [email protected] reply 0
debug1: session_input_channel_req: session 0 req [email protected]

答案1

SSH 代理程式轉送並未包含在 Windows OpenSSH 專案的原始工作範圍內(請參閱專案範圍wiki 頁面,將此功能稱為「身份驗證轉送」)。

不過,看來這個功能將在未來的版本中得到解決。這下一個里程碑包括對代理轉發問題的多個引用:

答案2

至少在Windows 11上,您可以使用SSH代理轉發,但您需要執行ssh驗證代理:

  1. 從“開始”功能表開啟“服務”應用程式。
  2. 向下捲動至“OpenSSH 身份驗證代理程式”。
  3. 右鍵單擊該服務以存取其“屬性”。將其“啟動類型”更改為“自動(延遲啟動)”。 “確定”儲存您的變更。
  4. 右鍵單擊該服務並從上下文選單中選擇“啟動”。

答案3

Windows 上預設會停用 SSH-Agent。

[OpenSSH金鑰管理][1]文章

# By default the ssh-agent service is disabled. Allow it to be manually started for the next step to work.
# Make sure you're running [Powershell] as an Administrator.
Get-Service ssh-agent | Set-Service -StartupType Manual

# Start the service
Start-Service ssh-agent

# This should return a status of Running
Get-Service ssh-agent

# Now load your key files into ssh-agent
ssh-add ~\.ssh\id_ed25519

相關內容