Hey I'm using bash on windows 10 to try to get a quick and easy way to SSH into my Ubuntu server on Amazon Web Services. As far as I can tell everything is set up properly but when I go to ssh

$ ssh -vvv -i key.rsa ubuntu@123.456.789.123

I get

OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 123.456.789.123 [123.456.789.123] port 22.
debug1: connect to address 123.456.789.123 port 22: Resource temporarily unavailable
ssh: connect to host 123.456.789.123 port 22: Resource temporarily unavailable

Connecting via Putty is fine. What gives?

EDIT: I've gotten one step further by adding this line to the end of /etc/ssh/ssh_config:

ProxyCommand nc %h %p %r

but now I've got a new problem:

$ ssh -vvv -i id_rsa 123.456.789.123
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Executing proxy command: exec nc 123.456.789.123 22 User
debug1: permanently_drop_suid: 1000
debug3: Incorrect RSA1 identifier
debug3: Could not load "id_rsa" as a RSA1 public key
debug1: identity file id_rsa type 1
debug1: identity file id_rsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8
nc: getaddrinfo: Servname not supported for ai_socktype
ssh_exchange_identification: Connection closed by remote host

this exact same command with the exact same key works on my server (to ssh into itself).

$ ssh-keygen -l -f id_rsa

confirms that it's the same valid key. Putty still works, so it's not my AWS port settings. There is no SSH entry in the server log when I attempt to connect from WinBash, but (of course) an entry appears when my server SSHes into itself, so I'm guessing it's something up with my client-side setup, but what?

  • Does Windows still firewall by application? Perhaps PuTTY is allowed through the firewall, but ssh is not? – Eric Renouf Nov 21 '16 at 13:28
  • Tried turning off Windows firewall, didn't help. – GameKyuubi Nov 21 '16 at 15:09

Your proxy command should be:

ProxyCommand nc %h %p

nc does not need your ssh username, just omit it.

If you pass your username (%r) to nc, as a third parameter, nc sees it as a symbolic port (service) identifier and tries to translate it to a port number, which it can't. This is the error you get "Servname not supported for ai_socktype" (Servname here is actually your username).

[edit] Hmmm, that said, I don't think your ProxyCommand will help. Back to the first error, I believe you are limited by your system which, somehow, prevents your program (be it ssh or nc) from establishing a network connection to that server/port. It might not be a firewall issue but rather a system limitation for ssh and/or Cygwin. Sorry, I don't know Windows, and I can't help further.


As far as I know, you should have .ppk when creating a new instance on AWS. If you have .ppk file that generated by yourself.

Open a Putty session and go to the Connection section and choose Auth section that under the SSH section.

Lastly, browse .ppk and load it then open the session. As an important point that, before above mentioned process, you should set hostname and port in the Sessions tab.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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