ssh登录Windows的子系统Ubuntu

场景需求:
服务器为Windows,所有的测试设备连接在Windows上,其他电脑无法通过ssh登录远程服务器,连接设备。首先保证网络是通的,即被远程的Ubuntu子系统和本地是可以ping通的。

环境:

服务环境Windows10

1.在微软商店搜索并安装Ubuntu18或20

打开Ubuntu报错:WslRegisterDistribution failed with error: 0x8007019e

管理员身份打开powdershell,执行

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

重启电脑

2.重装Ubuntu的ssh服务

 

sudo apt remove --purge openssh-server

 

3.配置Ubuntu的ssh配置

sudo apt-get update
sudo apt-get install openssh-server
sudo ps -e |grep ssh
sudo service ssh start
sudo ps -e |grep ssh #可以看到sshd服务启动

4.远程连接Windows服务器的Ubuntu子系统,ssh user@host即可登录

 

 

posted @ 2022-03-29 17:15  小柴i  阅读(580)  评论(0编辑  收藏  举报