ssh: connect to host localhost port 22: Connection refused

悠悠 2022-09-15 12:39 246阅读 0赞

Ubuntu通过ssh连接其他主机时出现如下报错

  1. ssh: connect to host localhost port 22: Connection refused

区分是否为本机问题:

  1. ssh localhost

输入上面命令没有出现报错,则不是本机问题,需要从其他主机入手。

错误原因:
1.sshd 未安装
2.sshd 未启动
3.防火墙未关闭

解决方法:
1.安装sshd

  1. sudo apt-get install openssh-server
  2. sudo service ssh restart

2.重新启动sshd

  1. sudo service ssh restart

3.关闭防火墙

  1. sudo ufw disable
  2. sudo service ssh restart

完结!

发表评论

表情:
评论列表 (有 0 条评论,246人围观)

还没有评论,来说两句吧...

相关阅读