Windows – Can’t connect via SSH from WIndows 10

firewallputtysshwindows 10

I'm trying to connect to another device on my local network: 192.168.0.55 with Putty. I can do it fine from one computer but another does not work. The one that does not work is running Windows 10 and only has the built in firewall and Windows Defender installed. This is the error message I get

error message

I tried adding rules to the Windows firewall to allow incoming and outgoing connections on port 22 but it didn't make a difference. It used to work fine.

Best Answer

First, outbound SSH traffic does not use port 22, it is being redirected to port 22. By default, it chooses a port from the dynamic range. And also, you need no rules for outbound SSH connections, unless such connections are explicitly blocked by the firewall. A network connection will be established via stateful connection tracking (supported by almost any modern firewall, read more here).
You shouldn't be worried for your outbound connection ports at all.

Reasons why you might experience that behaviour:

  1. PuTTY isn't in the list of allowed applications in the firewall -- it is not allowed to establish connections.
  2. Depending on how you've added it, your rule might also not work. A bug on some versions on Windows (most commonly Windows 7) is seen, where a firewall rule will not work if the allowed path contains variables (like %username%). If PuTTY is allowed in the firewall, but still not able to connect, then make sure you don't have a path with variables and make sure PuTTY is just located on an absolute path without those. An example of this bug can be found here.
  3. PuTTY might need administrator rights to create a socket, from TCP/IP Raw Sockets:

    Raw sockets offer the capability to manipulate the underlying transport, so they can be used for malicious purposes that pose a security threat. Therefore, only members of the Administrators group can create sockets of type SOCK_RAW on Windows 2000 and later.

A quick guide for allowing applications through the firewall:
Windows 10: Allow/Block Apps in Windows Firewall

Related Question