


OpenSSH on Windows: Installation, Configuration, and Usage Guide
For most Windows users, Remote Desktop Protocol (RDP) has always been the first choice for remote management because it provides a friendly graphical interface. However, for system administrators who require more granular control, SSH may better suit their needs. SSH allows administrators to interact with remote devices through the command line, making management more efficient. The advantages of SSH are its security and flexibility, making it easier for administrators to perform remote management and maintenance tasks, especially when dealing with large numbers of devices or performing automated tasks. So while RDP excels in terms of user-friendliness, for system administrators, SSH is superior in functionality and control.
Previously, Windows users needed third-party tools like PuTTY (open source) or Xshell (commercial) to use SSH. However, now Microsoft has launched an OpenSSH client and server built into Windows, providing users with a more convenient choice. This move brings a lot of convenience to users, who no longer need to rely on external software for easy SSH connections and data transfer. This means users can access remote servers more quickly and make secure file transfers without having to install and configure additional software. This move by Microsoft also shows that they are constantly improving and optimizing the Windows operating system to provide a better user experience and wider functionality. Windows users can now more easily take advantage of SSH technology, and
In Windows, OpenSSH is an optional feature that needs to be added manually, and the system will not install it automatically. This article will guide you on how to install, configure, and use the OpenSSH client and server in Windows 11 or Windows 10 (version 1809 and above).
What is OpenSSH?
OpenSSH is a tool for secure remote connections and computer management that uses encryption technology to ensure the security of communications. The main functions include remote login, command execution, file transfer, port forwarding, etc.
OpenSSH consists of two parts: client and server, including:
- Client: used to connect to the remote server.
- Server: Runs on the remote server and accepts client connection requests.
OpenSSH was originally developed for Linux systems and now also supports multiple operating systems including Windows and macOS.
Installing the OpenSSH client and/or server in Windows
Preparation conditions
Before you start installing OpenSSH, please make sure your computer meets the following conditions:
- Operating system: Windows 11 or Windows 10 (version 1809 or higher).
- PowerShell version: PowerShell 5.1 or above.
- Administrator permissions: Installing OpenSSH requires administrator permissions.
Method 1: Install through "Settings"
1Use the Windows I
shortcut key to open "Settings" and select "System" > "Optional Features".
2 Click "View Functions" and enter OpenSSH
in the search box to filter.
3 Check as needed:
- OpenSSH client: You can use the ssh command to connect to other SSH-enabled devices.
- OpenSSH Server: Allows other devices to connect to your computer via SSH.
Add OpenSSH client and server
4 After selecting, click "Next", then click "Install" to start the installation process.
Method 2: Install using PowerShell
1Use the Windows R
shortcut key to open the "Run" dialog box, enter powershell
, and then press Ctrl Shift Enter
to open the PowerShell window with administrator privileges.
2Execute the following command to view the OpenSSH installation status:
Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'
If NotPresent
is returned, it means it is not installed; if Installed
is returned, it means it is installed.
3Install OpenSSH client and server components as needed:
# 安装 OpenSSH 客户端 Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0 # 安装 OpenSSH 服务器 Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
Install OpenSSH client or server components
在 Windows 中配置 OpenSSH 服务器
当你在 Windows 上安装了 OpenSSH 服务器之后,需要进行一些配置才能接受连接:
1使用Windows + R
快捷键打开「运行」对话框,输入powershell
,然后按Ctrl + Shift + Enter
以管理员权限打开 PowerShell。
2设置 SSHD 服务自动启动:
Set-Service -Name sshd -StartupType 'Automatic'
3启动 SSHD 服务:
Start-Service sshd
4检查 SSH 服务器是否在侦听 22 端口:
netstat -an | findstr /i ":22"
5确保 Windows Defender 防火墙允许 TCP 22 端口的入站连接:
Get-NetFirewallRule -Name *OpenSSH-Server* | select Name, DisplayName, Description, Enabled
配置 OpenSSH 服务器
如规则丢失或被禁用,可以创建新规则:
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
6(可选)如果要修改配置,如设置用户访问权限,可以编辑sshd_config
配置文件:
Start-Process Notepad C:Programdatasshsshd_config
7根据需要修改配置文件,保存后关闭记事本。
OpenSSH 服务器配置文件可以在 sshd_config 手册页中找到。
编辑 sshd_config 配置文件
8完成更改后,重启 SSHD 服务应用配置:
Restart-Service sshd
重启 SSHD 服务
按照这些步骤,你的 Windows 就能通过 SSH 协议接受连接了。
使用 OpenSSH 客户端连接远程 SSH 服务器
在 Windows 中安装完 OpenSSH 客户端后,就可以立即与远程 SSH 设备建立连接:
1打开命令提示符或 Powershell,执行以下命令来检查 OpenSSH 客户端是否已经正确安装:
ssh
2使用以下命令连接到配置了 SSH 的服务器:
ssh [用户名]@[服务器IP]
使用 OpenSSH 客户端连接远程服务器
3首次连接时,会要求你输入密码。如果远程设备使用非标准 22 端口,需要指定端口号:
ssh 用户名@服务器名称 -p 端口号
Windows 上的 OpenSSH 是一个强大的工具,可用于远程管理设备和服务器。本文提供了详细的安装、配置和使用指南,帮助你充分利用 OpenSSH 的功能。
The above is the detailed content of OpenSSH on Windows: Installation, Configuration, and Usage Guide. For more information, please follow other related articles on the PHP Chinese website!

What is zlib1.dll? Some people encountered the “zlib1.dll is missing” error or zlib1.dll not found error when they attempt to open an application that includes zlib1.dll. To fix these related errors, this article on php.cn Website can give you some i

Some of you might find that AutoFill is not working in Excel. Can you come up with any solutions on that? If not, then you have come to the right spot. This post on php.cn Website will provide you with 6 ways to solve Excel AutoFill not working.

What is Windows 7 Starter Edition? What are the limitations of Windows 7 Starter Edition? How to get the Windows 7 Starter Edition ISO? This post from php.cn provides detailed information about Windows 7 Starter Edition for you.

When running an App, are you troubled with changing accounts by logging out of the present one and then logging in to another? php.cn has collected some effective ways to help you run apps as a different user in Windows 10 and Windows 11.

Are you suffering from the “Dropbox there was an error downloading your file” error in Windows? Now read this post given by php.cn to get several useful solutions to this problem.

Are you troubled by the problem of “selected files are not highlighted in File Explorer”? Do you know how to fix it? If not, you can read this post on php.cn to get several feasible solutions to make selected files visible in File Explorer.

The language bar is essential if you work with multilanguage. You can change the input language by tweaking the setting from the taskbar. But the language bar might disappear one day when you open the computer. How to fix the language bar missing fro

Want to use an external drive to expand your phone’s storage? It is possible to do this. This php.cn post shows you a guide on how to connect an external drive to a phone. Besides, if you need to recover data from your external drive, you can try php


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Dreamweaver CS6
Visual web development tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.