Amazon EC2上的远程端口转发失败

时间:2016-12-04 20:38:53

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

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

我使用

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

然而,当我成功连接到实例时,我得到了欢迎的错误

  

警告:侦听端口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.

1 个答案:

答案 0 :(得分:2)

if ("Parent".equals(auth_user)) {

看起来您正在尝试打开两个不同的端口转发(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 localhost),它们基本相同。您是否也在127.0.0.1设置了转发功能?使用~/.ssh/config运行可能会显示更多信息。

也可以使用-vvv中的AllowTcpForwarding在服务器上禁用它。