wsl ssh连接失败配置流程
1、wsl2 ifconfig的网络ip是虚拟的ip,所以采用wsl1
2、wsl1的安装教程。
3、openssh-server重装
sudo apt-get update
sudo apt-get remove openssh-server
sudo apt-get install openssh-server
4、修改ssh配置文件
sudo vim /etc/ssh/sshd_config
其中的 PasswordAuthentication 改为yes
PasswordAuthentication yes
5、重启ssh
wsl没有systemctl,使用service启动
sudo service ssh restart
6、ssh免密配置
a 、生成公钥
一路enter
ssh-keygen
b 、上传公钥到服务器
ssh-copy-id -i ~/.ssh/id_rsa.pub username@192.168.XX.XX