Installing OpenSSH from the Settings UI on Windows Server 2019 or Windows 10 1809

OpenSSH client and server are installable features of Windows 10 1809.

To install OpenSSH, start Settings then go to Apps > Apps and Features > Manage Optional Features.

Scan this list to see if OpenSSH client is already installed. If not, then at the top of the page select "Add a feature", then:

  • To install the OpenSSH client, locate "OpenSSH Client", then click "Install".
  • To install the OpenSSH server, locate "OpenSSH Server", then click "Install".

Once the installation completes, return to Apps > Apps and Features > Manage Optional Features and you should see the OpenSSH component(s) listed.

备注

Installing OpenSSH Server will create and enable a firewall rule named "OpenSSH-Server-In-TCP". This allows inbound SSH traffic on port 22.

Installing OpenSSH with PowerShell

To install OpenSSH using PowerShell, first launch PowerShell as an Administrator. To make sure that the OpenSSH features are available for install:

PowerShell复制
Get-WindowsCapability -Online | ? Name -like 'OpenSSH*'

# This should return the following output:

Name  : OpenSSH.Client~~~~0.0.1.0
State : NotPresent
Name : OpenSSH.Server~~~~0.0.1.0
State : NotPresent

Then, install the server and/or client features:

PowerShell复制
# Install the OpenSSH Client
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0 # Install the OpenSSH Server
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0 # Both of these should return the following output: Path :
Online : True
RestartNeeded : False

Uninstalling OpenSSH

To uninstall OpenSSH using the Windows Settings, start Settings then go to Apps > Apps and Features > Manage Optional Features. In the list of installed features, select the OpenSSH Client or OpenSSH Server component, then select Uninstall.

To uninstall OpenSSH using PowerShell, use one of the following commands:

PowerShell复制
# Install the OpenSSH Client
Remove-WindowsCapability -Name OpenSSH.Client~~~~0.0.1.0 # Install the OpenSSH Server
Remove-WindowsCapability -Name OpenSSH.Server~~~~0.0.1.0

A Windows restart may be required after removing OpenSSH, if the service is in use at the time it was uninstalled.

Upgrading From "RS4"

Users who installed the beta version of OpenSSH in Windows RS4 should consider the making following updates.

Change the default location for administrator keys

  • What is the reason for each activity?
  • Are there any other changes (e.g.: authorized key file location)

Initial Configuration of SSH Server

To configure the OpenSSH server for initial use on Windows, launch PowerShell as an administrator, then run the following commands to start the SSHD service:

PowerShell复制
Start-Service sshd
# OPTIONAL but recommended:
Set-Service -Name sshd -StartupType 'Automatic'
# Confirm the Firewall rule is configured. It should be created automatically by setup.
Get-NetFirewallRule –Name *ssh*
# There should be a firewall rule named "OpenSSH-Server-In-TCP", which should be enabled

Initial use of SSH

Once you have installed the OpenSSH Server on Windows, you can quickly test it using PowerShell from any Windows device with the SSH Client installed. In PowerShell type the following command:

PowerShell复制
Ssh username@servername

The first connection to any server will result in a message similar to the following:

复制
The authenticity of host 'servername (10.00.00.001)' can't be established.
ECDSA key fingerprint is SHA256:(<a large string>).
Are you sure you want to continue connecting (yes/no)?

The answer must be either “yes” or “no”. Answering Yes will add that server to the local system’s list of known ssh hosts.

You will be prompted for the password at this point. As a security precaution, your password will not be displayed as you type.

Once you connect you will see a command shell prompt similar to the following:

复制
domain\username@SERVERNAME C:\Users\username>

The default shell used by Windows OpenSSH server is the Windows command shell.

最新文章

  1. JSP 入门 HTML嵌套Java脚步 显示时间
  2. PHP学习笔记:使用session来存储用户的登录信息
  3. 首先,定义一个Print类,它有一个方法void output(int x),如果x的值是1,在控制台打印出大写的英文字母表;如果x的值是2,在 控制台打印出小写的英文字母表。其次,再定义一个主类——TestClass,在主类 的main方法中创建Print类的对象,使用这个对象调用方法output ()来打印出大 小写英文字母表。
  4. 跨域请求之jQuery的ajax jsonp的使用解惑
  5. Java多线程-工具篇-BlockingQueue
  6. java常用日期函数总结
  7. 添加xml文件编辑语法提示
  8. CSS控制文本超出后隐藏并用省略号代替
  9. Python多线程的创建,相关函数和守护线程的理解
  10. c#中反射
  11. Angular自定义组件实现数据双向数据绑定
  12. django报错Manager isn&#39;t accessible via UserInfo instances
  13. 【从零开始自制CPU之学习篇03】锁存器与触发器
  14. Module 10:I/O流(java如何实现与外界数据的交流)
  15. week06 12 我们准备数据 前端调用rpc 前后端联调一下
  16. mac 上sublime3安装编码插件
  17. bzoj2893(费用流)
  18. Javascript的堆和栈的简单理解
  19. 如何使用Android Studio提高App质量
  20. super-pow

热门文章

  1. Net dll组件版本兼容问题
  2. leetcode367--Valid Perfect Square
  3. C++之静态的变量和静态函数
  4. scapy学习笔记(4)简单的sniffing 嗅探
  5. DAY65
  6. jqgrid 设置行编辑为本地端编辑状态
  7. Debian 鼠标左右手
  8. 详解如何使用Docker Hub官方的MySQL镜像生成容器
  9. 【H5】滚动事件(jq)
  10. Feeling_2018_5_21