我一直使用 PuTTY 和 WinSCP SSH 连接到 EC2。我最近Commands > Open in PuTTY
在 WinSCP 中发现了该功能,但它似乎不起作用。连接时我收到此错误(PuTTY):
网络错误:连接被拒绝
这是 PuTTY 事件日志中的错误:
2018-05-23 22:40:11 Connecting to ::1 port 22
2018-05-23 22:40:11 We claim version: SSH-2.0-PuTTY_Release_0.70
2018-05-23 22:40:12 Failed to connect to ::1: Network error: Connection refused
2018-05-23 22:40:12 Connecting to 10.8.x.x port 22
2018-05-23 22:40:13 Failed to connect to 10.8.x.x: Network error: Connection refused
2018-05-23 22:40:13 Connecting to 192.168.x.x port 22
2018-05-23 22:40:14 Failed to connect to 192.168.56.1: Network error: Connection refused
2018-05-23 22:40:14 Connecting to 192.168.x.x port 22
2018-05-23 22:40:15 Failed to connect to 192.168.x.x: Network error: Connection refused
2018-05-23 22:40:15 Network error: Connection refused
(部分 IP 地址已用 xx 删除)
显然问题出在它所连接的 IP 上(第一行)
2018-05-23 22:40:11 Connecting to ::1 port 22
工作事件日志如下所示:
2018-05-23 22:44:01 Connecting to o.o.o.o port 22
2018-05-23 22:44:01 We claim version: SSH-2.0-PuTTY_Release_0.70
2018-05-23 22:44:01 Server version: SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.4
2018-05-23 22:44:01 Using SSH protocol version 2
2018-05-23 22:44:01 Doing ECDH key exchange with curve Curve25519 and hash SHA-256
2018-05-23 22:44:02 Server also has ecdsa-sha2-nistp256/ssh-rsa host keys, but we don't know any of them
2018-05-23 22:44:02 Host key fingerprint is:
2018-05-23 22:44:02 ssh-ed25519 256 <removed>
2018-05-23 22:44:02 Initialised AES-256 SDCTR client->server encryption
2018-05-23 22:44:02 Initialised HMAC-SHA-256 client->server MAC algorithm
2018-05-23 22:44:02 Initialised AES-256 SDCTR server->client encryption
2018-05-23 22:44:02 Initialised HMAC-SHA-256 server->client MAC algorithm
2018-05-23 22:44:02 Reading key file "<removed>"
2018-05-23 22:44:02 Pageant is running. Requesting keys.
2018-05-23 22:44:02 Pageant has 1 SSH-2 keys
2018-05-23 22:44:02 Configured key file not in Pageant
2018-05-23 22:44:02 Offered public key
2018-05-23 22:44:02 Offer of public key accepted
2018-05-23 22:44:02 Sent public key signature
2018-05-23 22:44:02 Access granted
2018-05-23 22:44:02 Opening session as main channel
2018-05-23 22:44:03 Opened main channel
2018-05-23 22:44:03 Allocated pty (ospeed 38400bps, ispeed 38400bps)
2018-05-23 22:44:03 Started a shell/command
其中o.o.o.o
第 1 行代表 EC2 实例的公网 IP。
知道为什么连接::1
来自 WinSCP 而不是正确的 IP 地址吗?
当我按住Ctrl+Shift并单击时,Open in PuTTY
这是剪贴板的内容:
"C:\Program Files\PuTTY\putty.exe" -load aws-ubuntu
aws-ubuntu
是 WinSCP 中配置/站点的名称。
答案1
当您在 PuTTY 中存储的会话与 WinSCP 中当前站点的名称匹配时,WinSCP 将指示 PuTTY 使用该会话,而不是将 WinSCP 设置传递给 PuTTY。
看https://winscp.net/eng/docs/integration_putty#session_configuration
你的情况就是这样的(-load aws-ubuntu
)。
看来您aws-ubuntu
在 PuTTY 中的会话配置与 WinSCP 站点的配置不一样aws-ubuntu
。
删除或修复aws-ubuntu
PuTTY 中的会话。