【问题标题】:Remote port forwarding failed on Amazon EC2Amazon EC2 上的远程端口转发失败
【发布时间】:2017-04-19 04:53:45
【问题描述】:

我正在尝试在远程 EC2 实例上使用 rsub

我使用

连接到它
ssh -i keyPair.pem -R 52698:localhost:52698 ubuntu@address.amazonaws.com

但是,当我成功连接到实例时,我收到欢迎 error

警告:监听端口 52698 的远程端口转发失败

rsub 的目标是建立一个隧道,以便能够从我的 GUI 中通过 ssh 编辑远程文件。

欢迎任何有关此错误的帮助!

详细错误(-v)是:

OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /Users/victor/.ssh/config
debug1: /Users/victor/.ssh/config line 1: Applying options for *
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: /etc/ssh_config line 102: Applying options for *
debug1: Connecting to ec2-52-53-211-179.us-west-1.compute.amazonaws.com [52.53.211.179] port 22.
debug1: Connection established.
debug1: identity file /Users/victor/vict0rsch.pem type -1
debug1: identity file /Users/victor/vict0rsch.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.1
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.1 pat OpenSSH*
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-sha1-etm@openssh.com none
debug1: kex: client->server aes128-ctr hmac-sha1-etm@openssh.com none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<2048<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA a5:e2:ba:33:0a:6a:4b:55:5e:62:8f:1d:d9:bd:eb:9a
debug1: Host 'ec2-52-53-211-179.us-west-1.compute.amazonaws.com' is known and matches the RSA host key.
debug1: Found key in /Users/victor/.ssh/known_hosts:23
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/victor/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Offering RSA public key: /Users/victor/.ssh/ec2_CS224D_1.pem
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentication succeeded (publickey).
Authenticated to ec2-52-53-211-179.us-west-1.compute.amazonaws.com ([52.53.211.179]:22).
debug1: Remote connections from LOCALHOST:52698 forwarded to local address localhost:52698
debug1: Remote connections from LOCALHOST:52698 forwarded to local address 127.0.0.1:52698
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug1: remote forward success for: listen 52698, connect localhost:52698
debug1: remote forward failure for: listen 52698, connect 127.0.0.1:52698
Warning: remote port forwarding failed for listen port 52698
debug1: All remote forwarding requests processed
debug1: Sending environment.

【问题讨论】:

  • @l0b0 没关系。该端口仅在 localhost 上,出路被“封闭”在 SSH 流量中。

标签: amazon-web-services ssh amazon-ec2 sublimetext2


【解决方案1】:
debug1: remote forward success for: listen 52698, connect localhost:52698
debug1: remote forward failure for: listen 52698, connect 127.0.0.1:52698
Warning: remote port forwarding failed for listen port 52698

您似乎正在尝试打开两个不同的端口转发(localhost127.0.0.1),它们基本上是相同的。您是否也在~/.ssh/config 中设置了转发?使用-vvv 运行可能会显示更多信息。

也可以在服务器上使用AllowTcpForwarding in sshd_config 禁用它。

【讨论】:

  • 确实我忘记了这个,我也在我的 ~/.ssh/config 中设置了它。干杯
  • 尝试使用GatewayPorts yesAllowTCPForwarding yes 远程ec2服务器中的两个配置仍然无法通过互联网访问本地服务器,但能够在服务器终端内访问它。发生这种情况的任何原因?
  • @ManjunathJakaraddi 你是用localhost还是服务器的实际外部IP地址?
  • 实际的外部公共 IP 地址(事实上,我可以通过相同的外部 IP 访问托管在网络服务器中的其他应用程序,但不能通过转发的远程端口访问)
  • @ManjunathJakaraddi 防火墙呢?它是否允许你访问你机器上的这个端口?
猜你喜欢
  • 2014-11-19
  • 1970-01-01
  • 1970-01-01
  • 2019-04-25
  • 1970-01-01
  • 1970-01-01
  • 2021-01-27
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多