卸载ssh,再安装ssh
sudo apt-get remove --purge openssh-server ## 先删ssh
sudo apt-get install openssh-server ## 在安装ssh
sudo rm /etc/ssh/ssh_config
sudo service ssh --full-restart
修改配置文件
sudo vim /etc/ssh/sshd_config
更改以下配置项
Port 6666
ListenAddress 0.0.0.0
PasswordAuthentication yes
PermitRootLogin yes
sudo service ssh --full-restart
sudo dpkg-reconfigure openssh-server
给wsl设置root密码
sudo passwd root
连接xshell
主机号设置为127.0.0.1,端口号设为刚刚设置的6666,即可连接
标签:--,openssh,sudo,server,ssh,Ubuntu,Xshell,wsl2,连接 From: https://www.cnblogs.com/ltaodream/p/17782548.html