1.查看ssh服务的状态
systemctl status sshd
2.异常情况下可以重新安装
yum -y remove openssh
yum -y install openssh
systemctl start sshd
3.还不行检查下systemctl status sshd报错日志,
journalctl -xe
日志中提示“Unable to load host key "/etc/ssh/ssh_host_***_key": bad permissions”
处理方式:
查看ls -al /etc/ssh/sshd_*key,删除有问题的密钥,重启sshd服务,就解决了。
# rm -r /etc/ssh/ssh*key # systemctl restart sshd
或者使用ssh-keygen命令来手动生成密钥,不用重启服务。
# ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key # ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key # ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key标签:sshd,ping,etc,host,systemctl,ssh,key,linux From: https://www.cnblogs.com/zmm521/p/18552486