connection closed by foreign host / Permissions 0620 for '/etc/ssh/ssh_host_ed25519_key' are too open 解决方案

发生此次故障的原因:

  在文件夹授权时 错误的执行了 chmod -R 755 /

本来只想授权当前文件夹的 结果...

然后就导致xshell连不上了 懵逼...

解决方案 将权限收回:

执行: chmod -R 600 /etc/ssh/

重启: systemctl status sshd.service

以下是解决问题时的一些关键字:

[root@iZ2vcdtfg9o3j8bu9odeqyZ server]# systemctl restart sshd
Job for sshd.service failed because the control process exited with error code. See "systemctl status sshd.service" and "journalctl -xe" for details.
[root@iZ2vcdtfg9o3j8bu9odeqyZ server]# systemctl status sshd.service
● sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Wed 2019-09-11 10:26:32 CST; 5s ago
Docs: man:sshd(8)
man:sshd_config(5)
Process: 24730 ExecStart=/usr/sbin/sshd -D $OPTIONS (code=exited, status=1/FAILURE)
Main PID: 24730 (code=exited, status=1/FAILURE)

Sep 11 10:26:32 iZ2vcdtfg9o3j8bu9odeqyZ sshd[24730]: Permissions 0620 for '/etc/ssh/ssh_host_ed25519_key' are too open.
Sep 11 10:26:32 iZ2vcdtfg9o3j8bu9odeqyZ sshd[24730]: It is required that your private key files are NOT accessible by others.
Sep 11 10:26:32 iZ2vcdtfg9o3j8bu9odeqyZ sshd[24730]: This private key will be ignored.
Sep 11 10:26:32 iZ2vcdtfg9o3j8bu9odeqyZ sshd[24730]: key_load_private: bad permissions
Sep 11 10:26:32 iZ2vcdtfg9o3j8bu9odeqyZ sshd[24730]: Could not load host key: /etc/ssh/ssh_host_ed25519_key
Sep 11 10:26:32 iZ2vcdtfg9o3j8bu9odeqyZ sshd[24730]: sshd: no hostkeys available -- exiting.
Sep 11 10:26:32 iZ2vcdtfg9o3j8bu9odeqyZ systemd[1]: sshd.service: main process exited, code=exited, status=1/FAILURE
Sep 11 10:26:32 iZ2vcdtfg9o3j8bu9odeqyZ systemd[1]: Failed to start OpenSSH server daemon.
Sep 11 10:26:32 iZ2vcdtfg9o3j8bu9odeqyZ systemd[1]: Unit sshd.service entered failed state.
Sep 11 10:26:32 iZ2vcdtfg9o3j8bu9odeqyZ systemd[1]: sshd.service failed.
[root@iZ2vcdtfg9o3j8bu9odeqyZ server]# chmod -R 600 /etc/ssh/
[root@iZ2vcdtfg9o3j8bu9odeqyZ server]# systemctl status sshd.service
● sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2019-09-11 10:27:14 CST; 436ms ago
Docs: man:sshd(8)
man:sshd_config(5)
Main PID: 24735 (sshd)
CGroup: /system.slice/sshd.service
└─24735 /usr/sbin/sshd -D

Sep 11 10:27:14 iZ2vcdtfg9o3j8bu9odeqyZ systemd[1]: Starting OpenSSH server daemon...
Sep 11 10:27:14 iZ2vcdtfg9o3j8bu9odeqyZ sshd[24735]: Server listening on 0.0.0.0 port 10022.
Sep 11 10:27:14 iZ2vcdtfg9o3j8bu9odeqyZ systemd[1]: Started OpenSSH server daemon.

posted @ 2019-09-11 10:38  AmbitiousMice  阅读(2475)  评论(0编辑  收藏  举报