無法使用 ssh 金鑰存取 Windows 10 上的伺服器

無法使用 ssh 金鑰存取 Windows 10 上的伺服器

我成功連接到 Linux 上的伺服器,但無法使用複製到 Windows 10 電腦的相同 ssh 金鑰連接到同一伺服器。我已經在論壇上針對這個問題做了很多研究,但找不到答案。

這是我在 Windows 上收到的偵錯訊息:

C:\Users\Valentin\.ssh>ssh XXXXXX -vvv
OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
debug1: Reading configuration data C:\\Users\\Valentin/.ssh/config
debug1: C:\\Users\\Valentin/.ssh/config line 1: Applying options for
XXXXXX [Host]
debug3: Failed to open file:C:/ProgramData/ssh/ssh_config error:2
debug2: resolve_canonicalize: hostname 111111 is address
debug1: Executing proxy command: exec ssh -A -W 111111
[email protected] -i C:\\Users\\Valentin\\.ssh\\id_rsa
debug3: spawning "C:\\WINDOWS\\System32\\OpenSSH\\ssh -A -W 111111
[email protected] -i C:\\Users\\Valentin\\.ssh\\id_rsa"
CreateProcessW failed error:2
posix_spawn: No such file or directory
It says Failed to open file:C:/ProgramData/ssh/ssh_config error:2 but I do not have this file at all. Is this mandatory to have (on Linux everything is running fine without it. In addition to that I already have the config file on my Windows)?

這是我的設定檔的樣子:

C:\Users\Valentin\.ssh>type config
Host            XXXXXX
HostName        111111
User            xxx
ProxyCommand    ssh -A -W %h:%p [email protected] -i C:\Users\Valentin\.ssh\id_rsa
AddKeysToAgent  yes
IdentityFile    C:\Users\Valentin\.ssh\id_rsa

顯然,我有不同的主機、主機名稱等。請注意,我設法使用 ssh 金鑰在 Windows 上執行 git clone 來驗證它們是否有效。所以我預測問題不在於鑰匙,而是路徑。

注意:油灰這是我最不想用的東西。首先,我想確保有一種更簡單的方法可以做到這一點,而無需安裝任何其他軟體。

如果有人能幫我解決這個問題,我將非常感激。

相關內容