解决ssh: connect to host 192.168.x.x port 22: Connection refused

我在使用scp命令向另一目标主机传输文件时提示ssh: connect to host 192.168.x.x port 22: Connection refused错误,总结出现的原因,及解决办法。

查看目标主机的ssh服务是否启动

service ssh status

 如下图显示则启动状态

 如果提示Unit ssh.service could not be found则说明未安装ssh。

安装命令

sudo apt-get install openssh-server

启动ssh服务

systemctl start ssh 或 service ssh start

重启ssh服务

systemctl restart ssh

停止ssh服务

systemctl stop ssh

如果未解决可以在查看目标主机的22断口是否在监听。

猜你喜欢

转载自blog.csdn.net/m0_67254672/article/details/136044228