Windows10搭建ssh server
注意:是在Windows搭建ssh server提供给外部访问,不是Linux。主要步骤参考Microsoft官方文章Install OpenSSH | Microsoft Docs1. 首先Windows10当前的版本本身就支持openssh-server,只是默认关闭,需要我们开启To install the OpenSSH components:OpenSettings, selectApp
·
注意:是在Windows搭建ssh server提供给外部访问,不是Linux。
主要步骤参考Microsoft官方文章 Install OpenSSH | Microsoft Docs
1. 首先Windows10当前的版本本身就支持openssh-server,只是默认关闭,需要我们开启
To install the OpenSSH components:
-
Open Settings, select Apps > Apps & Features, then select Optional Features.
-
Scan the list to see if the OpenSSH is already installed. If not, at the top of the page, select Add a feature, then:
- Find OpenSSH Client, then click Install
- Find OpenSSH Server, then click Install
2. 从命令行启动服务
# Start the sshd service
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
# If the firewall does not exist, create one
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
3. 尝试从ubuntu连接Windows的ssh server
不知道是公司电脑域管理的问题还是什么,我用administrator是访问失败的,所以我新建了一个用户:
然后再次访问就成功了:
jianxin@ubuntu:~$ ssh jianxin@192.168.109.1
jianxin@192.168.109.1's password:
Microsoft Windows [版本 10.0.18363.592]
(c) 2019 Microsoft Corporation。保留所有权利。
jianxin@xxxx C:\Users\jianxin>
同时也可以使用scp进行文件拷贝了
jianxin@ubuntu:~$ scp jianxin@192.168.109.1:D:/test2.html .
jianxin@192.168.109.1's password:
test2.html 100% 8586 3.8MB/s 00:00
更多推荐
已为社区贡献1条内容
所有评论(0)