1.在宿主机Windows上安装ssh
参见微软文档安装OpenSSH
2.在Ubuntu上安装ssh
2.1安装openssh
- 安装openssh-client
sudo apt install openssh-client
- 安装openssh-server
sudo apt install openssh-server
- 启动openssh-server
sudo /etc/init.d/ssh restart
- 查看ssh-server工作状态
netstat-tpl
2.2配置防火墙
# 查看防火墙状态
sudo ufw status
# 禁用防火墙
sudo ufw disable
3.连接
# 临时保持ssh连接,每60秒通信一次
ssh -o ServerAliveInterval=60 user@sshserver