Use OpenSSH on Windows Machines to Securely Transfer Files (2024)

Linux and Unix admins are accustomed to using Open Secure Shell (OpenSSH) to connect to servers because it has been included in those systems for decades. Windows users, on the other hand, have traditionally had to download third-party tools like Putty or WinSCP to utilize SSH capabilities.

However, that changed when OpenSSH became available as an optional feature in Windows 10 and Windows Server 2019. Because Windows now natively offers both SSH server and SSH client, there is no reason to ever use telnet or FTP, which have no encryption capabilities — SSH offers superior security when you need to connect to a server or copy files over a network connection.

This article details how to install OpenSSH and use it to securely transfer files using either WinSCP or PowerShell.

What is OpenSSH used for?

OpenSSH is a tool that provides secure communication sessions over a computer network using the SSH protocol. It can be used for a variety of tasks, including the following:

  • Securely log in to remote machines to execute commands for server management or technical support.
  • Securely copy or move files between two machines.

These tasks are secure because OpenSSH includes the Secure Copy protocol (SCP) and the SSH File Transfer protocol (SFTP), and OpenSSH encrypts all traffic through a secure tunnel, enabling you to transmit sensitive data across the internet or unsecure network. The tunnel is created when the client and server exchange public keys.

How to Add the OpenSSH Feature on Windows

Prerequisites

To install OpenSSH on a Windows machine:

  • The device must be running at least Windows Server 2019 or Windows 10 (build 1809).
  • The machine must be running PowerShell 5.1 or later.
  • You must use an account that is a member of the built-in Administrators group.

You should start by checking whether OpenSSH is already installed. Using an Administrators Window PowerShell terminal, run this command:

Get-WindowsCapability -Online -Name "Open*"

You can see in the screenshot below that OpenSSH client is installed but OpenSSH server is not.

Use OpenSSH on Windows Machines to Securely Transfer Files (1)

You can install both the OpenSSH server and the OpenSSH client using either Windows settings or PowerShell, as explained below.

Installing OpenSSH using Windows Settings

  1. To start, go to the Apps & features section of Settings and click Manage optional features.
Use OpenSSH on Windows Machines to Securely Transfer Files (2)
  • Click Add a feature.
Use OpenSSH on Windows Machines to Securely Transfer Files (3)
  • To install the server component, select OpenSSH Server and click the Install button.
Use OpenSSH on Windows Machines to Securely Transfer Files (4)
  • Next, install the SSH client. Select OpenSSH Client and click Install. Note that if the client is already installed, you will see an Uninstall button instead, as shown below; in that case, no action is necessary.
Use OpenSSH on Windows Machines to Securely Transfer Files (5)
  • Configure the OpenSSH service to run automatically using Windows Services Manager, as illustrated in this screenshot:
Use OpenSSH on Windows Machines to Securely Transfer Files (6)
  • If Windows Defender Firewall with Advanced Security is enabled, you will have to open port 22, which is assigned to SSH by the Internet Assigned Numbers Authority (IANA).

Using PowerShell to Install OpenSSH

Alternatively, you can install the OpenSSH server and client components using Windows PowerShell.

  1. Install the OpenSSH server component using the following command:
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
Use OpenSSH on Windows Machines to Securely Transfer Files (7)
  • Then install OpenSSH client using the following command:
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
  • Then use the following PowerShell commands to configure the OpenSSH service and start it.
Start-Service sshdSet-Service -Name sshd -StartupType ‘Automatic’
Use OpenSSH on Windows Machines to Securely Transfer Files (8)
  • As noted earlier, port 22 must be open on the firewall. You can quickly check whether a firewall rule is already configured for OpenSSH using the following command:
Get-NetFirewallRule -Name *ssh*

The output below shows that a rule has already been created.

Use OpenSSH on Windows Machines to Securely Transfer Files (9)

If the rule is absent, use the following command to open the SSH port:

New-NetFirewallRule -Name sshd -DisplayName ‘OpenSSH Server (sshd)’ -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
  • Last, ensure that everything is set up correctly and the OpenSSH daemon is listening for incoming connections. To test the connection, run the following command from a different server or desktop machine:
Test-NetConnection -ComputerName <computer name> -Port 22 -InformationLevel Detailed

If the test is successful, you will see something like this:

Use OpenSSH on Windows Machines to Securely Transfer Files (10)

If it fails, then it could mean several things related to network connectivity; such as the Firewall rule not being created or enabled on a remote computer.

How to Move a File using SSH

Moving a file using SSH is nearly the same as moving one with an FTP application like WinSCP. Note that you must have permission to read the file on the source machine and write permission on the destination directory.

Moving a File using WinSCP

First, let’s first use the WinSCP utility to test out the new SSH server. (If needed, you can download WinSCP here.) Note that if you use WinSCP, you do not need to enable the OpenSSH client.

  1. Open WinSCP and define a new connection to the server: Choose New Site, make sure that the file protocol is set to SFTP and the port is set to 22 (the default values), and input a username, as shown in the example below.
Use OpenSSH on Windows Machines to Securely Transfer Files (11)
  • Click the Login button and supply the password for the account you specified. The next dialog box will display the server’s ECDSA key fingerprint, as shown in the screenshot below.This key is used primarily to ensure that the client is communicating with the right server. When the client connects to the server for the first time, the public host key is passed on to the client. Click Yes to proceed.
Use OpenSSH on Windows Machines to Securely Transfer Files (12)
  • In the next window, the left pane will display the source machine’s default folder, and the right pane will display the default folder for the user on the target server. Navigate to the desired folders. In the example below, we right-clicked on a file to download it to the client device. Alternatively, you can drag the files from one side to the other.
Use OpenSSH on Windows Machines to Securely Transfer Files (13)

Copy a File or Directory using OpenSSH

To copy a file using Windows OpenSSH, you can use the following PowerShell command. Note that both the OpenSSH server and client must be enabled.

scp <filename> <username>@<hostname>:<directory_path>

To copy an entire directory, use the following command.

scp -r <local_directory_path> <username>@<hostname>:<remote_directory_path>

If the directory does not exist on the target server, it will be created (assuming you have permission to do so).

You can also copy files back and forth from Linux and Unix servers to Windows servers and desktops.

How Netwrix Can Help

If you are moving or copying data files, chances are you need to protect that data — not just during the transfer operation but throughout its lifecycle. Data access governance software from Netwrix provides an effective and scalable approach to file activity monitoring. Moreover, it will help you reduce the risk of cybersecurity incidents by enabling you to understand who has access to what and strictly limit access to sensitive data. You can:

  • Audit activity across your IT ecosystem.
  • Reduce access to sensitive data to the required minimum to reduce the risk of insider threats and minimize the damage from ransomware and other attacks.
  • Streamline regular privilege attestations by data owners.
  • Protect sensitive data whenever it goes with accurate and consistent tagging of content.

Frequently Asked Questions

How do you move a file using SSH?

When working with Unix-like systems, you can use the mv command to move a file from one location to another on a remote server using SSH.

For Windows machines, you can either install a third-party SSH server and client application, or enable the OpenSSH feature (requires Windows Server 2019 or 2022, or Windows 10 or 11).

In either case, you must have the logon credentials to connect, as well as the necessary permissions to read the file on the source machine and write permission on the destination directory.

Does SSH allow file transfer?

Yes. SSH includes the Secure Copy protocol (SCP) and SSH File Transfer protocol (SFTP), which enable the secure transfer of files between a local host and a remote host.

How can I transfer files from an SSH server to a local machine?

One way to transfer a file from an OpenSSH server to a machine with a supported version of Windows or Windows Server is to use the following PowerShell command:

scp C:\path\to\local\file username@remote-server:/path/to/remote/directory
  • Replace C:\path\to\local\file with the path to the file you want to copy on your local machine.
  • Replace username with the username on the remote server. (You will be prompted for the password.)
  • Replace remote-server with the hostname or IP address of the remote server.
  • Replace path/to/remote/directory with the path to the directory on the remote server where you want the file copied.

Alternatively, you can use third-party SSH utilities that offer easy-to-use menus.

Use OpenSSH on Windows Machines to Securely Transfer Files (14)

Ethan Israel

Ethan is a Product Manager at Netwrix. With over 10 years of experience in the software industry, he is responsible for building and delivering on the roadmap for the Netwrix Enterprise Auditor product.

Use OpenSSH on Windows Machines to Securely Transfer Files (2024)

FAQs

Is OpenSSH for Windows Secure? ›

OpenSSH is a connectivity tool for remote sign-in that uses the SSH protocol. It encrypts all traffic between client and server to eliminate eavesdropping, connection hijacking, and other attacks.

What is a secure method to transfer files using SSH? ›

SFTP (SSH File Transfer Protocol) is a secure file transfer protocol. It runs over the SSH protocol. It supports the full security and authentication functionality of SSH. SFTP has pretty much replaced legacy FTP as a file transfer protocol, and is quickly replacing FTP/S.

Can you SSH to Windows machines? ›

The latest builds of Windows 10 and Windows 11 include a built-in SSH server and client that are based on OpenSSH, a connectivity tool for remote sign-in that uses the SSH protocol.

Is an OpenSSH port secure? ›

It is well known that SSH servers listen for incoming connections on TCP Port 22. As such, Port 22 is subject to countless, unauthorized login attempts by hackers who are attempting to access unsecured servers.

What is the security flaw in OpenSSH? ›

Millions of OpenSSH servers are susceptible to a critical vulnerability that allows remote code execution operations, bypassing authentication safeguards. A security research team at Qualys found the bug, known as regreSSHion (CVE-2024-6387). The bug primarily affects Glibc-based Linux systems.

Which version of OpenSSH is secure? ›

OpenSSH versions earlier than 4.4p1 are vulnerable to this signal handler race condition unless they are patched for CVE-2006-5051 and CVE-2008-4109. Versions from 4.4p1 up to, but not including, 8.5p1 are not vulnerable due to a transformative patch for CVE-2006-5051, which made a previously unsafe function secure.

What is the most secure file transfer method? ›

Secure File Transfer Protocol (SFTP) is a more secure version of FTP that uses Secure Shell (SSH) to encrypt data. Unlike FTPS, it is not an extension of FTP, but rather a secure alternative to FTP. SFTP is the most secure option of the three protocols, as it encrypts both the commands and data being transferred.

Is SSH good for file transfer? ›

A network protocol that uses SSH for secure file transfers. SSH is a secure protocol that uses encryption to protect data in transit. SFTP also provides secure data transfers, utilizing SSH for encryption. Uses public-key authentication, password-based authentication, or both.

What is the difference between FTP and SSH file transfer? ›

FTP only allows the file transfer. SSH allows the remote file transfer as well as shell access.

How to enable OpenSSH in Windows? ›

Set up a Windows 10 SSH server:
  1. Open “Settings” > “Apps” > “Apps & Features” > “Optional Features.
  2. Select “Add Features” and “OpenSSH Server” and “Install” (admin rights required).
  3. Set the startup type for “OpenSSH Authentication Agent” and “OpenSSH Server” to “Automatic” in the Windows “Services” app.
Oct 4, 2023

Why would you want to use SSH from a Windows PC? ›

In addition to providing strong encryption, SSH is widely used by network administrators to manage systems and applications remotely, enabling them to log in to another computer over a network, execute commands and move files from one computer to another.

What is a disadvantage to using SSH? ›

SSH requires some software and settings to use, and it may not be compatible with some older or simpler devices. SSH also requires some knowledge and skills to use properly, such as generating and managing keys, choosing encryption algorithms, or troubleshooting errors.

What is better than OpenSSH? ›

Best Paid & Free Alternatives to OpenSSH
  • Egnyte.
  • Virtru.
  • AWS Key Management Service (KMS)
  • HashiCorp Vault.
  • Azure Key Vault.
  • GnuPG.
  • Keyfactor Command.
  • Akeyless Platform.

Is there a difference between OpenSSH and SSH? ›

OpenSSH is the open-source version of the Secure Shell (SSH) tools used by administrators of Linux and other non-Windows for cross-platform management of remote systems.

Is SSH actually secure? ›

SSH is "secure" because it incorporates encryption and authentication via a process called public key cryptography. Public key cryptography is a way to encrypt data, or sign data, with two different keys. One of the keys, the public key, is available for anyone to use.

Is Remote Desktop over SSH Secure? ›

RDP: Historically targeted by exploits and vulnerabilities, requiring frequent patching and security updates to mitigate risks. SSH: Inherently designed with security as a primary consideration, making it less susceptible to vulnerabilities compared to RDP.

How to secure SSH in Windows? ›

Here is our top 10 list for how to secure your Open SSH:
  1. Strong Usernames and Passwords. ...
  2. Configure Idle Timeout Interval. ...
  3. Disable Empty Passwords. ...
  4. Limit Users' SSH Access. ...
  5. Only Use SSH Protocol 2. ...
  6. Allow Only Specific Clients. ...
  7. Enable Two-Factor Authentication. ...
  8. Use Public/Private Keys for Authentication.
Apr 10, 2017

Are SSH apps safe? ›

The SSH protocol

All user authentication, commands, output, and file transfers are encrypted to protect against attacks in the network.

References

Top Articles
27407 Real Estate - 27407 Homes For Sale | Zillow
Designing The Perfect Feature Comparison Table — Smashing Magazine
55Th And Kedzie Elite Staffing
Metallica - Blackened Lyrics Meaning
Craigslist Vans
Summit County Juvenile Court
Wellcare Dual Align 129 (HMO D-SNP) - Hearing Aid Benefits | FreeHearingTest.org
Usborne Links
Kansas Craigslist Free Stuff
1movierulzhd.fun Reviews | scam, legit or safe check | Scamadviser
Fototour verlassener Fliegerhorst Schönwald [Lost Place Brandenburg]
Ub Civil Engineering Flowsheet
Mail Healthcare Uiowa
Rainfall Map Oklahoma
Ukraine-Russia war: Latest updates
今月のSpotify Japanese Hip Hopベスト作品 -2024/08-|K.EG
Lima Funeral Home Bristol Ri Obituaries
Does Breckie Hill Have An Only Fans – Repeat Replay
ARK: Survival Evolved Valguero Map Guide: Resource Locations, Bosses, & Dinos
CDL Rostermania 2023-2024 | News, Rumors & Every Confirmed Roster
Icivics The Electoral Process Answer Key
Sodium azide 1% in aqueous solution
Craigslist Northfield Vt
PCM.daily - Discussion Forum: Classique du Grand Duché
Koninklijk Theater Tuschinski
15 Primewire Alternatives for Viewing Free Streams (2024)
Amerisourcebergen Thoughtspot 2023
Mta Bus Forums
Masterbuilt Gravity Fan Not Working
Taylored Services Hardeeville Sc
Toonkor211
Bursar.okstate.edu
R3Vlimited Forum
Nextdoor Myvidster
Flixtor Nu Not Working
Forager How-to Get Archaeology Items - Dino Egg, Anchor, Fossil, Frozen Relic, Frozen Squid, Kapala, Lava Eel, and More!
Song That Goes Yeah Yeah Yeah Yeah Sounds Like Mgmt
Hannibal Mo Craigslist Pets
Geology - Grand Canyon National Park (U.S. National Park Service)
Kornerstone Funeral Tulia
2 Pm Cdt
Go Bananas Wareham Ma
The Angel Next Door Spoils Me Rotten Gogoanime
Ig Weekend Dow
Powerboat P1 Unveils 2024 P1 Offshore And Class 1 Race Calendar
60 Days From May 31
New Starfield Deep-Dive Reveals How Shattered Space DLC Will Finally Fix The Game's Biggest Combat Flaw
6463896344
Roller Znen ZN50QT-E
Strange World Showtimes Near Century Federal Way
Comenity/Banter
Kindlerso
Latest Posts
Article information

Author: Virgilio Hermann JD

Last Updated:

Views: 5565

Rating: 4 / 5 (41 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Virgilio Hermann JD

Birthday: 1997-12-21

Address: 6946 Schoen Cove, Sipesshire, MO 55944

Phone: +3763365785260

Job: Accounting Engineer

Hobby: Web surfing, Rafting, Dowsing, Stand-up comedy, Ghost hunting, Swimming, Amateur radio

Introduction: My name is Virgilio Hermann JD, I am a fine, gifted, beautiful, encouraging, kind, talented, zealous person who loves writing and wants to share my knowledge and understanding with you.