使用SSH连接WSL

1. SSH配置过程

#先删掉原有的ssh
$ sudo apt-get remove --purge openssh-server

#重新安装ssh服务
$ sudo apt-get install openssh-server ssh  

#编辑sshd_config文件,修改几处配置才能正常使用用户名/密码的方式连接
$ sudo vi /etc/ssh/sshd_config

#需要找到并修改以下几项
# 找到这几行把前面的注释#号去掉
Port 22
AddressFamily any
ListenAddress 0.0.0.0
ListenAddress ::   

PermitRootLogin yes #默认是PermitRootLogin prohibit-password

#启动ssh服务
sudo service ssh --full-restart

2. 注意:

  • IP使用127.0.0.1(或者localhost);端口为 22

 

 

参考:https://www.cnblogs.com/mydailycoding/p/12375273.html

 

posted on 2021-01-11 11:42  闹不机米  阅读(174)  评论(0编辑  收藏  举报

导航