原文是网站制作学习网的FoAsP.cn

 怎么通过ssh 连接windows 安装的wsl,下面配置过程说一下:
1. 首先要知道你要连接的ip
通过命令行cmd进入wsl。通过命令查看 本机ip
->ip a  或者 ifconfig 
 
如果跟本机windows或者时内网的一个IP。则用 127.0.0.1 进行连接wsl 22端口
 
2. 安装启动ssh 服务,运行命令入下:
#安装ssh服务
sudo apt install openssh-server

#关闭ssh 防火墙,让其可以通过ssh访问
sudo ufw allow ssh

#启动ssh 服务
sudo service ssh start
 
3.编辑配置文件:
sudo vim /etc/ssh/sshd_config
配置如下:
PasswordAuthentication yes
PubkeyAuthentication yes
 
3. 测试远程连接
ssh name@192.168.x.x 
 
4.如果没有密码,需要在命令行wsl 中配置或者修改。


原载于:文章来源:www.forasp.cn网站制作学习