Windows Server 2019 Firewall Settings Blocking Key Pair Authentication

Abstract: Resolve Windows Server 2019 firewall blocking SFTP key pair authentication by configuring outbound rules for port 22.

Created: 2026-09-01 by
Windows Server 2019 firewall settings do not block key pair authentication itself, as that is an application-layer encryption method handled by the SFTP client software. However, the firewall often blocks the underlying network traffic required for the connection, specifically port 22 for SSH/SFTP or specific outbound rules that restrict which remote hosts your server can communicate with. When an application relying on key-based authentication suddenly fails while working in development, the issue is almost always a change in network policy rather than the cryptographic handshake. The Windows Defender Firewall may have blocked the outbound connection to the vendor's FTP site due to a new rule, a system update, or a misconfigured application profile. To resolve this, you must ensure that the firewall allows outbound traffic on the correct port and that the application has the necessary permissions to initiate these connections without restriction.

Understanding Why Key Authentication Fails

It is crucial to distinguish between the authentication mechanism and the transport layer. Key pair authentication occurs after the TCP connection is established. If the firewall blocks the initial connection attempt, the application never reaches the stage where it attempts to use the private key. Therefore, troubleshooting focuses on connectivity first, then configuration. In many cloud environments, Windows Server instances are placed behind additional network security groups or virtual firewalls provided by the cloud provider (such as AWS Security Groups or Azure Network Security Groups). Even if the local Windows Firewall is open, these external filters can drop packets before they reach the operating system. You must verify that both the local Windows Firewall and any cloud-provider-level network ACLs permit outbound traffic on port 22 (or the custom port used by the vendor).

Configuring Outbound Rules for SFTP Traffic

To allow your application to connect to vendor FTP sites, you need to create or modify outbound rules in the Windows Defender Firewall. This process ensures that the SFTP client can send data out to the internet without being intercepted. Follow these steps to configure the necessary rules:
  1. Open Advanced Security: Press Win + R, type wf.msc, and press Enter to open the Windows Defender Firewall with Advanced Security console.
  2. Navigate to Outbound Rules: In the left pane, click on "Outbound Rules" to view existing restrictions.
  3. Create a New Rule: Click "New Rule..." in the right-hand Actions pane.
  4. Select Port Type: Choose "Port" and click Next.
  5. Specify Protocol and Ports: Select "TCP". In the "Specific local ports" field, enter 22 (or the specific port number your vendor uses). Click Next.
  6. Allow the Connection: Ensure "Allow the connection" is selected. Click Next.
  7. Apply Profiles: Check all three profiles (Domain, Private, Public) unless you have a specific reason to restrict them. Click Next.
  8. Name the Rule: Give it a descriptive name like "Allow SFTP Outbound Port 22" and add a comment explaining it is for vendor file uploads. Click Finish.
If your application runs under a specific user context or service account, you may also need to ensure that the application executable itself is permitted through the firewall. You can do this by creating a program-based rule instead of a port-based rule, pointing directly to the .exe file of your SFTP client or upload script.

Handling Specific Vendor IP Addresses

For enhanced security, you can limit this rule to only allow connections to the specific vendor IP addresses. During the rule creation wizard, after selecting the port, you can edit the rule properties to add remote IP addresses. This prevents your server from inadvertently connecting to other unintended hosts on port 22, reducing the attack surface.

Verifying Cloud Provider Network Settings

As mentioned, Windows Server 2019 in a cloud environment is rarely isolated. The hypervisor or cloud management layer enforces its own network policies. If the local Windows Firewall is correctly configured but the connection still fails, check the cloud provider's dashboard. Look for Security Groups, Network ACLs, or Virtual Private Cloud (VPC) settings. Ensure that there is an outbound rule allowing TCP traffic on port 22 to 0.0.0.0/0 (all destinations) or specifically to the vendor's CIDR block. Many cloud defaults restrict outbound traffic to prevent data exfiltration, so this setting is frequently the culprit when development environments work but production does not.

Diagnostics and Troubleshooting Steps

If the rules are in place and the issue persists, use diagnostic tools to identify exactly where the connection is dropping.
  • Test Connectivity: Use the Test-NetConnection cmdlet in PowerShell. Run Test-NetConnection -ComputerName vendor-hostname -Port 22. If this times out, the network path is blocked. If it succeeds, the issue is likely within the application configuration.
  • Check Firewall Logs: Enable logging in the Windows Defender Firewall advanced settings to see if packets are being dropped. Look for entries with "Drop" action matching your outbound traffic.
  • Review Application Logs: Check the logs of your SFTP client. Errors such as "Connection Refused" or "Network Unreachable" indicate firewall issues, while "Authentication Failed" indicates a problem with the key file or permissions.
For more detailed guidance on managing complex firewall interactions, you might find Understanding Conflicting Rules in Windows Defender Firewall for PyCharm 2024.2.3 helpful, as it explains how to troubleshoot overlapping rules that can cause unexpected blocking behavior.

Security Best Practices

While opening port 22 outbound is necessary for functionality, it should be done with caution. Avoid creating overly broad rules that allow any application to connect to any host on port 22. Instead, bind rules to specific executables or limit remote IPs to known vendors. Additionally, ensure that the private key files stored on the server have strict NTFS permissions, accessible only by the service account running the upload task. This prevents unauthorized users from stealing keys even if they gain limited access to the server. For related issues regarding limiting traffic to specific servers, consider reviewing Limiting Outbound Traffic for Specific Servers/PCs in Win11 Firewall, which offers strategies for granular control over outbound connections.

Frequently Asked Questions

Does the Windows Firewall encrypt the data transfer?

No, the Windows Firewall only controls network access based on ports and protocols; it does not handle encryption. Encryption for SFTP is handled by the SSH protocol stack within your SFTP client software. The firewall simply ensures the packet can reach the destination.

Why did this work in development but fail in production?

Development environments often run on local machines with permissive firewall settings or no external network filters. Production servers in the cloud typically have stricter default outbound rules and additional security group layers that are not present in local dev setups.

Can I disable the firewall entirely to fix this?

Disabling the firewall is strongly discouraged as it exposes the server to all inbound and outbound threats. Instead, create specific allow rules for the required ports and applications. This maintains security while enabling the necessary functionality.

How do I check if my cloud provider is blocking the port?

Log into your cloud provider's console (AWS, Azure, GCP, etc.) and locate the Security Group or Network ACL associated with your instance. Verify that there is an outbound rule permitting TCP traffic on port 22. If no such rule exists, the cloud provider is blocking the traffic before it hits Windows.

What if the vendor uses a non-standard port?

If the vendor uses a port other than 22, you must create a new outbound rule specifying that exact port number. Ensure your SFTP client configuration also points to the correct port. Mismatched port numbers between the client config and the firewall rule will result in connection failures.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More