Skip to content

Commit 64345be

Browse files
authored
Update troubleshoot-openssh-windows-firewall-port22.md
Edit review per CI 7981
1 parent 8faf3c4 commit 64345be

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

support/windows-server/system-management-components/troubleshoot-openssh-windows-firewall-port22.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Troubleshoot OpenSSH Communication through Windows Firewall
2+
title: Troubleshoot OpenSSH Communication Through Windows Firewall
33
description: Discusses how to troubleshoot issues that affect OpenSSH commands that pass through Windows Firewall.
44
ms.date: 12/17/2025
55
manager: dcscontentpm
@@ -16,7 +16,7 @@ ms.custom:
1616

1717
This article discusses how to troubleshoot issues that affect OpenSSH commands that pass through Windows Firewall.
1818

19-
By default, OpenSSH uses TCP port 22. If this port is blocked or not listening, SSH commands fail. By default, OpenSSH listens on both IPv4 (0.0.0.0:22) and IPv6 ([::]:22). Windows Firewall settings, service status, and network permissions all play a crucial role in ensuring that port 22 is both listening and accessible. Many factors can block OpenSSH communication, such as the following issues:
19+
By default, OpenSSH uses TCP port 22. If this port is blocked or not listening, SSH commands fail. By default, OpenSSH listens on both IPv4 (0.0.0.0:22) and IPv6 ([::]:22). Windows Firewall settings, service status, and network permissions all play a crucial role in making sure that port 22 is both listening and accessible. Many factors can block OpenSSH communication, such as the following issues:
2020

2121
- The OpenSSH service isn't running or is misconfigured.
2222
- Port 22 isn't listening because of service or firewall problems.
@@ -28,7 +28,7 @@ By default, OpenSSH uses TCP port 22. If this port is blocked or not listening,
2828

2929
### Step 1: Verify the basic functionality
3030

31-
1. To verify that OpenSSH installed correctly, open a Windows PowerShell Command Prompt window and then run the following command:
31+
1. To verify that OpenSSH installed correctly, open a Windows PowerShell Command Prompt window, and then run the following command:
3232

3333
```powershell
3434
Get-Service -Name sshd
@@ -43,7 +43,7 @@ By default, OpenSSH uses TCP port 22. If this port is blocked or not listening,
4343
netstat -an | findstr :22
4444
```
4545

46-
The following example shows the response to this command when port 22 is listening for traffic.
46+
The following example shows the response to this command when port 22 is listening for traffic:
4747

4848
```output
4949
TCP 0.0.0.0:22 0.0.0.0:0 LISTENING
@@ -58,35 +58,35 @@ By default, OpenSSH uses TCP port 22. If this port is blocked or not listening,
5858
> - Avoid using port 22 for non-OpenSSH traffic.
5959
> - Audit your firewall rules regularly.
6060
61-
1. To check for existing firewall rules, on your OpenSSH client computer, run the following cmdlet at a PowerShell command prompt.
61+
1. To check for existing firewall rules, go to your OpenSSH client computer, and run the following cmdlet at a PowerShell command prompt:
6262

6363
```powershell
6464
Get-NetFirewallRule -DisplayName "*SSH*" | Get-NetFirewallPortFilter | Where-Object {$_.LocalPort -eq 22}
6565
```
6666

67-
1. If you can't find an existing SSH rule, open and administrative PowerShell command prompt window. Then run the following cmdlet:
67+
1. If you can't find an existing SSH rule, open an administrative PowerShell command prompt window. Then, run the following cmdlet:
6868

6969
```powershell
7070
New-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -DisplayName "OpenSSH Server (SSH)" -Enabled True -Direction Inbound -Protocol TCP -LocalPort 22 -Action Allow
7171
```
7272

73-
1. To check that the rule is correctly configured, run `Get-NetFirewallRule` again.
73+
1. To verify that the rule is correctly configured, run `Get-NetFirewallRule` again.
7474

7575
### Step 3: Review the event logs for errors
7676

7777
In Event Viewer, review the entries in **Application and Services Logs** > **OpenSSH**.
7878

7979
### Step 4: If the port isn't listening, configure it
8080

81-
If in the previous steps `netstat` didn't report port 22 as "Listening," and the firewall rule is correctly configured, follow these steps:
81+
In the previous steps, if `netstat` didn't report port 22 as "Listening," and the firewall rule is correctly configured, follow these steps:
8282

8383
1. To check the service status, run the following command at a PowerShell command prompt:
8484

8585
```powershell
8686
Get-Service -Name sshd
8787
```
8888

89-
1. To check the OpenSSH configuration, in the C:\ProgramData\ssh\ folder, use a text editor to open the sshd_config file.
89+
1. To check the OpenSSH configuration, open the C:\ProgramData\ssh\ folder, and then use a text editor to open the sshd_config file.
9090
1. Go to the `Port` section of the file. If the port information is commented out, uncomment it, and then make sure that the value is `22`.
9191

9292
> [!IMPORTANT]
@@ -98,26 +98,26 @@ If in the previous steps `netstat` didn't report port 22 as "Listening," and the
9898
sshd -t
9999
```
100100

101-
1. To restart the OpenSSH server service, run the following cmdlet at a PowerShell command prompt.
101+
1. To restart the OpenSSH server service, run the following cmdlet at a PowerShell command prompt:
102102

103103
```powershell
104104
Restart-Service sshd
105105
```
106106

107107
### Step 5: Test for firewall issues
108108

109-
1. To create a temporary test rule, run the following cmdlet at a PowerShell command prompt
109+
1. To create a temporary test rule, run the following cmdlet at a PowerShell command prompt:
110110

111111
```powershell
112112
New-NetFirewallRule -Name "SSH-Test" -DisplayName "SSH Test Rule" -Enabled True -Direction Inbound -Protocol TCP -LocalPort 22 -Action Allow -Profile Any
113113
```
114114

115115
> [!NOTE]
116-
> This cmdlet creates a temporary rule called "SSH Test Rule" that opens port 22. By using this approach, you avoid having to disable the entire firewall.
116+
> This cmdlet creates a temporary rule that's named "SSH Test Rule" to open port 22. By using this approach, you avoid having to disable the entire firewall.
117117
118118
1. Test some OpenSSH commands. If they work correctly, review and adjust your permanent firewall rules.
119119

120-
1. When you're finished, remove the test rule by running the following cmdlet at a PowerShell command prompt.
120+
1. When you're finished, remove the test rule by running the following cmdlet at a PowerShell command prompt:
121121

122122
```powershell
123123
Remove-NetFirewallRule -Name "SSH-Test"
@@ -145,7 +145,7 @@ If in the previous steps `netstat` didn't report port 22 as "Listening," and the
145145

146146
For information about verbose logging for OpenSSH, see [How to enable OpenSSH verbose logging](enable-openssh-verbose-logging.md).
147147

148-
Review the logs in %ProgramData%\ssh\logs for information about connection attempts and errors.
148+
For information about connection attempts and errors, review the logs in %ProgramData%\ssh\logs.
149149

150150
## Example scenarios
151151

0 commit comments

Comments
 (0)