概述
我正在尝试配置 ~/.ssh/config 以将我的本地 VSCode 连接到远程(EC2)。我已经进行了很多测试,但无法理解为什么一种情况有效,而另一些情况则失败。在通过 ssh 进入 BastionHost 后,我可以让 RemoteCommand 成功地通过 ssh 进入 EC2 实例,但是我无法使用 ProxyJump 或 ProxyCommand 实现同样的效果。VSCode 在使用 RemoteCommand 示例时没有列出 EC2 文件系统(只是到达 BastionHost),因此认为我需要根据大多数文档解析为 ProxyJump/ProxyCommand。
我尝试完全按照此处的说明操作,并尝试从其他文章中尝试不同的方法,但无济于事。
##WORKS
Host dev-ec2
HostName 10.248.000.206
User meme1
RemoteCommand ssh 10.248.000.201
RequestTTY yes
IdentityFile ~/.ssh/mykey
##WORKS
Host bastion-dev
HostName 10.248.000.206
User meme1
IdentityFile ~/.ssh/mykey
RequestTTY yes
##FAILS (times out)
Host dev-ec2-proxycommand
HostName 10.248.000.201
User meme1
ProxyCommand ssh.exe bastion-dev -W %h:%p
##FAILS (Permission denied on public key, even though no issue in the RemoteCommand example)
Host ec2-dev-proxyjump
HostName 10.248.000.201
User meme1
ProxyJump bastion-dev
IdentityFile ~/.ssh/mykey
系统信息
操作系统:Windows 10 Bastion 操作系统:Linux (Amazon Linux AMI)
免责声明
在过去的几天里,我一直在浏览 StackOverflow 和其他论坛,但无济于事,尽管我发现了类似的问题,但都没有提供可行的解决方案。