【发布时间】:2021-04-23 02:09:52
【问题描述】:
概述
我正在尝试配置 ~/.ssh/config 以将我的本地 VSCode 连接到远程 (EC2)。我做了很多测试,无法理解为什么一种情况有效,而另一些情况则失败。在通过 ssh 进入 BastionHost 后,我可以让 RemoteCommand 成功地通过 ssh 进入 EC2 实例,但是我无法使用 ProxyJump 或 ProxyCommand 实现同样的效果。 VSCode 在使用 RemoteCommand 示例时没有列出 EC2 文件系统(只是到达 BastionHost),因此认为我需要根据大多数文档解析为 ProxyJump/ProxyCommand。
我尝试完全按照here 的说明进行操作,并尝试了其他文章中的不同方法,但无济于事。
##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 堡垒操作系统:Linux (Amazon Linux AMI)
免责声明
过去几天我一直在查看 StackOverflow 和其他论坛,但无济于事,尽管我发现了类似的问题,但没有一个提供可行的解决方案。
【问题讨论】:
-
我了解您的操作系统是 Windows 10,但是您的跳转主机的操作系统是什么?
-
谢谢@Azize!跳转主机是 Linux,不确定特定发行版,如果有帮助,它是 Amazon Linux AMI。使用详细信息更新票证
标签: amazon-web-services visual-studio-code amazon-ec2 ssh bastion-host