1

Trying to connect to Digital Ocean from a Windows 10 computer and getting Connection timed out on port 22. I learned it is because the port is blocked and needs to be opened. This command sudo ufw allow 22 opens it in Linux. What is the similar command to open it in Windows?

1 Answer 1

1

Windows 10 has its own firewall, and it can be used to open port 22 for SSH connections. However, much like on GNU/Linux machines, you need some SSH server software to actually listen for and to facilitate these connections.

There is no default SSH server software that comes bundled with a Windows 10 install, but you can easily enable it as an optional feature.

  • Settings > Apps > Apps and Features > Manage Optional Features
  • To install the OpenSSH server, locate "OpenSSH Server", then click "Install".
  • Installing OpenSSH Server using this method will create and enable a firewall rule named "OpenSSH-Server-In-TCP". This allows inbound SSH traffic on port 22.

However, the 'ufw equivalent' PowerShell command to open this port for the OpenSSH daemon is: New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22

For more details on the steps I provided and steps to do all of the installation via PowerShell, you can visit the official Microsoft OpenSSH documentation

1
  • 1
    The answer provided by @Reece M is close but addresses cases when you are running a SSH server locally and expecting connections coming in - which is not the case here. The command seen in the documentation could still be adapted to your needs: New-NetFirewallRule -Name ssh-client -DisplayName 'OpenSSH Client (Outbound)' -Enabled True -Direction Outbound -Protocol TCP -Action Allow -RemotePort 22
    – Elhitch
    Commented Feb 3, 2021 at 20:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .