gpt4 book ai didi

windows - SSH 和 SCP 失败,错误为 "CreateProcessW failed error:2 posix_spawn: No such file or directory"

转载 作者:行者123 更新时间:2023-12-03 11:05:03 51 4
gpt4 key购买 nike

我正在尝试对 AWS 托管实例执行 SSH 和 SCP。我机器的公钥存储在该托管实例中。不需要 .pem 文件。我正在使用以下命令。

   scp -r  username@instance-id:/pathtoremotefile localpath
scp localfilepath username@instance-id:~
ssh username@instance-id
但是这些都没有在 Windows 中工作。错误说,“CreateProcessW failed error:2 posix_spawn: No such file or directory lost connection”。我会提到我可以使用此命令启动与该实例的 ssm session
   aws ssm start-session --target instance-id.
托管实例有 linux 操作系统,我的电脑有 Windows。
另外,在 .ssh 目录的配置文件中,我添加了以下几行。
 host i-* mi-*
ProxyCommand sh -c "aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p'"
奇怪的是,我可以使用相同的命令在同一台机器上的“Linux 的 windows 子系统”中同时执行 ssh 和 SCP。但是在 Windows 命令提示符下无法做到这一点。
我究竟做错了什么?

最佳答案

这似乎是 Windows openSSH 包的问题。
在 ProxyCommands 中,它请求完整路径限定符,但最好在那里使用正斜杠!

ProxyCommand C:/somepath/sh.exe -c "aws ssm ...
我不再使用 windows openSSH,而是使用 git-bash 中的 ssh 命令来避免所有 windows 问题。
关键代理工作完美,proxyCommand/proxyJumps 工作,与 windows 相比,它是可靠的。

关于windows - SSH 和 SCP 失败,错误为 "CreateProcessW failed error:2 posix_spawn: No such file or directory",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65059250/

51 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com