4

I ssh to EC2 all the time, using both PuTTY and WinSCP. I recently discovered the Commands > Open in PuTTY function in WinSCP, however it does not seem to work. When connecting I get this error (PuTTY):

Network error: Connection refused

And this is the error in PuTTY's event log:

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 addresses partially redacted with x.x)

Clearly the issue is with the IP it is connecting to (first line)

2018-05-23 22:40:11 Connecting to ::1 port 22

This is how a working event log looks like:

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

Where o.o.o.o in line 1 represents the public IP of the EC2 instance.

Any idea why the connection is ::1 from WinSCP and not the proper IP address?

When I hold down Ctrl+Shift while clicking on Open in PuTTY this is the content of the clipboard:

"C:\Program Files\PuTTY\putty.exe" -load aws-ubuntu

aws-ubuntu being the name of a configuration/site in WinSCP.

1

When you have a stored session in PuTTY that matches a name of the current site in WinSCP, WinSCP will instruct PuTTY to use that session, instead of passing WinSCP settings to PuTTY.

See https://winscp.net/eng/docs/integration_putty#session_configuration

That's your case (-load aws-ubuntu).

It seems that your aws-ubuntu session in PuTTY is not configured the same as WinSCP aws-ubuntu site.

Remove or fix the aws-ubuntu session in PuTTY.

  • @PimpJuiceIT I do not see how this relates to this question. If you have a problem, post a new question. – Martin Prikryl Jun 24 '18 at 18:55

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.