我无法从Visual代码获得使用这个ssm-proxy.sh脚本远程连接到AWS Cloud9的连接。我正在跟踪这篇文章关于如何使用AWS Cloud9来驱动我的Visual。我可以通过SSH连接,但在调用代理脚本时不行。
这样做是可行的:
Host test1
HostName xx.xxx.xxx.xx
User ec2-user
IdentityFile ~/.ssh/vscloud9
然而,这并不是:
Host cloud9
IdentityFile ~/.ssh/vscloud9
User ec2-user
HostName i-xxxxxxxxxxxxx
ProxyCommand sh -c "~/.ssh/ssm-proxy.sh %h %p"
使用AWS,我使用访问密钥和json的秘密和输出配置了默认的名为profile。尽管这是一种糟糕的做法,但访问密钥和秘密是为根用户提供的,因此权限不会导致问题。然后在ssm-proxy.sh中详细说明:
AWS_PROFILE='default'
AWS_REGION='eu-west-2'
MAX_ITERATION=5
SLEEP_DURATION=5
安全组中启用了来自任何地方的SSH。
因为普通SSH使用vscloud9密钥,所以密钥对不是问题所在。我认为问题要么是AWS概要文件,要么是ssm-proxy.sh脚本本身。
我正在使用远程SSH VSCode扩展.
我需要让这件事起作用,所以我想知道是否有人知道为什么这不起作用?
回应Anton在评论中的SSH输出:
OpenSSH_9.0p1, LibreSSL 3.3.6
debug1: Reading configuration data /Users/myname/.ssh/config
debug1: /Users/myname/.ssh/config line 6: Applying options for cloud9
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: include /etc/ssh/ssh_config.d/* matched no files
debug1: /etc/ssh/ssh_config line 54: Applying options for *
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug1: Executing proxy command: exec sh -c "~/.ssh/ssm-proxy.sh i-xxxxxxxxxxxxxx 22"
debug1: identity file /Users/myname/.ssh/vscloud9 type 0
debug1: identity file /Users/myname/.ssh/vscloud9-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_9.0
debug1: kex_exchange_identification: banner line 0: {
debug1: kex_exchange_identification: banner line 1: "StartingInstances": [
debug1: kex_exchange_identification: banner line 2: {
debug1: kex_exchange_identification: banner line 3: "CurrentState": {
debug1: kex_exchange_identification: banner line 4: "Code": 0,
debug1: kex_exchange_identification: banner line 5: "Name": "pending"
debug1: kex_exchange_identification: banner line 6: },
debug1: kex_exchange_identification: banner line 7: "InstanceId": "i-xxxxxxxxxxxxxx",
debug1: kex_exchange_identification: banner line 8: "PreviousState": {
debug1: kex_exchange_identification: banner line 9: "Code": 80,
debug1: kex_exchange_identification: banner line 10: "Name": "stopped"
debug1: kex_exchange_identification: banner line 11: }
debug1: kex_exchange_identification: banner line 12: }
debug1: kex_exchange_identification: banner line 13: ]
debug1: kex_exchange_identification: banner line 14: }
kex_exchange_identification: Connection closed by remote host
Connection closed by UNKNOWN port 65535
发布于 2022-11-29 13:11:03
请检查您的用户名。如果您正在使用ubuntu实例,请尝试在用户名中使用"ubuntu“而不是"ec2-user",反之亦然。
或
检查你的保安小组。确保您有允许通信从实例返回的出站规则。
使用默认出站规则
type: All traffic, Protocol: All, Ports: All, Destination: 0.0.0.0/0
在我的例子中,用户名是不正确的。在ubuntu实例上,它应该是"ubuntu“,而在amazon实例上,它应该是"ec2-user”。
看起来不错。
发布于 2022-11-29 13:13:36
尝试:
Host cloud9
HostName xx.xxx.xxx.xx
User ec2-user
IdentityFile ~/.ssh/vscloud9
ProxyCommand sh -c "~/.ssh/ssm-proxy.sh %h %p"
这会重新安排订单,所以我试着看看它是否会按照您提供的顺序工作。
https://stackoverflow.com/questions/74438823
复制相似问题