Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Allow ssh protocol through win 10 firewall

I have a workstation with Win 10 on which I installed OpenSSH server. If I try to connect to it (from another machine with Win 10 using ssh in a command prompt) I see it gives the following error:

ssh: connect to host Test3 port 22: Connection timed out

On wireshark Syn packets are sent but no answer is received back. If I dissable Windows firewall on destination then connection is established.

I want to leave the firewall enabled and disable only ssh port.

like image 798
Claudiu Cruceanu Avatar asked Apr 28 '26 02:04

Claudiu Cruceanu


2 Answers

You can easily use netsh.exe.

netsh advfirewall firewall add rule name="Open SSH Port 22" dir=in action=allow protocol=TCP localport=22 remoteip=any

You can also change remoteip to a specific host:

remoteip=any|localsubnet|dns|dhcp|wins|defaultgateway|<IPv4 address>|<IPv6 address>|<subnet>|<range>|<list>
like image 59
Krypton Razer Avatar answered Apr 29 '26 15:04

Krypton Razer


I found on microsoft site a link which allow to do it using graphical interface. I solved my problem performing the following steps as administrator:

  • Open the Group Policy Management Console / File/ Add snap-in / Windows Defender Firewall with Advanced Security(or Windows Settings/ Windows Defender Firewall / Advanced settings).
  • Inbound Rules / Actions / New rule
  • Rule Type / Port / Next
  • TCP / Specific port: 22 / Next
  • Allow the connection / Next / Next
  • Name / Open ssh port 22 / Finish
like image 39
Claudiu Cruceanu Avatar answered Apr 29 '26 16:04

Claudiu Cruceanu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!