今天下午用Finalshell连接一个新安装的ubuntu虚拟机的时候,‘爆’出了一个错误,java.net.ConnectException: Connection refused: connect。
当时脑子瞬间短路,回到虚拟机想要重启ssh服务器,就在终端看到这样的一个回复
service sshd restart
Failed to restart sshd.service: Unit sshd.service not found.
额,我忘记安装sshd服务。
之后又重新安装ssh。
sudo apt-get update
sudo apt-get install openssh-server
之后查看ssh服务
systemctl status sshd.service
在重启ssh
sudo systemctl restart sshd.service
用Finalshell重新连接
看到连接成功的字样
成功解决问题。