WSL-Ubuntu开启ssh

杂谈

使用apt安装ssh包

apt install ssh

启用ssh服务

service ssh start

此时连接会报错

kex_exchange_identification: Connection closed by remote host

缺少SSH Key,生成一个即可:

ssh-keygen -A

最后加入开机启动。

如果需要外部连接,需要在windows中开启端口转发:

netsh interface portproxy add v4tov4 listenport=22 listenaddress=0.0.0.0 connectport=22 connectaddress=localhost