【Centos】sshd 无法启动(解决问题篇)
问题:重启sshd服务出现问题如下
[root@dwidc]#systemctl start sshd
Error getting authority: Error initializing authority: Could not connect: No such file or directory (g-io-error-quark,1) Job for sshd.service failed because the control process exited with error code. see "systemctl status sshd.service" and "journal ctl -xe" for details
[root@dwidc]#
解决思路和方法
用systemctl status sshd命令查看sshd的状态
[root@dwidc]#systemclt status sshd
sshd.service -OpensSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
Active: activating Cauto-restart) (Result: exit-code) since Sun 2024-09-05 09: 30: 18 CST: 12s agp
Docs:man:sshd(8)
man:sshd_config(5)
Process:13561 Execstart=/usr/sbin/sshd -D $OPTIONS(code=exited,status=1/FAILURE)
Main pid:13561(code=exited status=1/FAIlURE)
Sep 05 09:30:18 dwidc sshd[13561]: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Sep 05 09:30:18 dwidc sshd[13561]: Permissions 0644 for '/etc/ssh/ssh_host_ed25519_key' are too open
Sep 05 09:30:18 dwidc sshd[13561]: It is required that your private key files are NoT accessible by others
Sep 05 09:30:18 dwidc sshd[13561]: This private key will be ignored
Sep 05 09:30:18 dwidc sshd[13561]: key_load_private: bad permissions
Sep 05 09:30:18 dwidc sshd[13561]: Could not load host key: /etc/ssh/ssh_host_ed25519_key
Sep 05 09:30:18 dwidc sshd[13561]: sshd: no hostkeys available -- exiting
Sep 05 09:30:18 dwidc systemd[1]: failed to start openSSH server daemon
Sep 05 09:30:18 dwidc systemd[1]: Unit sshd.service entered failed state
Sep 05 09:30:18 dwidc systemd[1]: sshd.service failed
[root@dwidc]#
发现有一句报错是
Permissions 0644 for '/etc/ssh/ssh_host_ed25519_key' are too open
这句话说的是你的这个key文件的权限过高
我们把权限调整下
chmod 600 /etc/ssh/ssh_host_ed25519_key
最后再用sshd -t 检查一下,发现没有问题。查看sshd的服务状态正常运行。