安裝ssh
sudo apt install openssh-server
sudo apt-get install openssh-server
啟動ssh
sudo service ssh start
ps -ef | grep sshd # 查看是否啟動成功
如果提示sshd error: could not load host key
嗡官,則需要重新生成key:
sudo dpkg-reconfigure openssh-server
WSL中ssh配置
vim /etc/ssh/sshd_config
修改如下內容:
Port 22 # 把這一行前面的#去掉
ListenAddress 0.0.0.0 # 去掉前面的#
PasswordAuthentication yes # 改成yes