Software⏱️ 3 min read📅 2026-06-04

How to Fix: How can I SSH into "Bash on Ubuntu on Windows 10"?

Troubleshoot SSH connection issues with Bash on Ubuntu on Windows 10.

Quick Answer: Check if the SSH server is running and listening on the correct port. Try using the command `ssh -o ServerAliveInterval=60` to increase the server's keepalive interval.

The 'Server unexpectedly closed network connection' error occurs when the SSH server is unable to establish a stable connection with the client. This issue affects users who have installed Bash on Ubuntu on Windows 10 and are trying to SSH into their Ubuntu instance. The frustration comes from the fact that the user has already configured and installed the OpenSSH server, yet still encounters this problem.

This error can be particularly challenging for users as it requires troubleshooting and understanding of network configurations, firewall settings, and SSH client issues.

🔍 Why This Happens

  • The primary reason for this issue is that the Bash on Ubuntu on Windows 10 environment uses a non-standard port (2200) for the OpenSSH server. This can cause conflicts with other applications or services running on the same system, leading to connection issues.
  • Another possible cause could be incorrect firewall settings or network configuration that prevents the SSH server from being accessible.

🛠️ Step-by-Step Verified Fixes

Enabling Non-Standard Port in Bash on Ubuntu on Windows

  1. Step 1: Open the Control Panel and navigate to System, then click on Advanced system settings.
  2. Step 2: In the Advanced system settings window, click on Environment Variables.
  3. Step 3: Under System Variables, scroll down and find the 'Bash on Ubuntu on Windows' environment variable, then click Edit.
  4. Step 4: In the 'Edit Environment Variable' window, select 'New' to create a new environment variable for the non-standard port (2200).
  5. Step 5: Enter '2200' in the 'Variable Value' field and click OK to save the changes.

Configuring Firewall Settings for SSH Server

  1. Step 1: Open Windows Defender Firewall with Advanced Security, then navigate to Inbound Rules.
  2. Step 2: Right-click on 'Inbound Rules', select 'New Rule', and choose 'Rule Type' as 'Port'.
  3. Step 3: Select 'Protocol' as 'TCP' and enter the non-standard port (2200) in the 'Specific local ports' field.
  4. Step 4: Choose 'Allow the connection' and then click Next, followed by 'Allow the rule to apply to all profiles' and Finish.

✨ Wrapping Up

To resolve the 'Server unexpectedly closed network connection' error when SSHing into Bash on Ubuntu on Windows 10, enable the non-standard port in the environment variable settings or configure firewall settings for the OpenSSH server. By following these steps, users should be able to establish a stable SSH connection and access their Ubuntu instance successfully.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions