我成功连接到 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 以验证它们是否有效。因此,我预测问题不在于密钥 - 而在于路径。
注意:油灰是我最不想用的东西。首先,我想确保有一种更简单的方法可以做到这一点,而无需安装任何额外的软件。
如果有人能帮助我,我将非常感激。