[Centos] sshd cannot be started (problem solving, with troubleshooting ideas and solutions)

foreword

A good day starts with helping people operate and maintain

question

My friend asked me the following questions:

[root@VM-0-16-centos /]# 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@VM-0-16-centos /]#

Solutions and methods

Permissions 0644 for '/etc/ssh/ssh_host_xxxxx_key'are too open

Then use systemctl status sshd. servicethe command to view the status of sshd,

[root@VM-0-16-centos /]#systemclt status sshd.service
● 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 2021-89-05 09: 30: 18 CST: 12s ago
     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 85 89: 30: 18 VM-8-16-centos sshd[13561]: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Sep B5 89: 30: 18 VM-9-16-centos sshd[13561]: Permissions 8644 for/etc/ssh/ssh_host_ed25519_key‘are too open
Sep 05 89: 30: 18 VM-0-16-centos sshd[13561]:It is required that your private key files are NoT accessible by others
Sep 05 89: 30: 18 VM-0-16-centos sshd[13561]: This private key will be ignored
Sep 85 89: 30: 18 UM-0-16-centos sshd[13561]: key_load_private: bad permissions
Sep 05 89: 30: 18 UM-0-16-centos sshd[13561]: Could not load host key: /etc/ssh/ssh_host_ed25519_key
Sep 05 89: 30: 18 VM-8-16-centos sshd[13561]: sshd: no hostkeys available -- exiting
Sep 05 89: 30: 18 UM-0-16-centos system[1]: Failed to start OpenSSH server daemon
Sep 05 89: 30: 18 UM-0-16-centos systemd[1]: Unit sshd.service entered failed state
Sep 05 89: 36: 18 UM-0-16-centos systemd[1]: sshd.service failed
[root@VM-0-16-centos /]#

 

Found that there is an error message is

Permissions 0644 for '/etc/ssh/ssh_host_ed25519_key' are too open

This sentence means that the permissions of your key file are too high

Let's adjust the permissions

chmod 600 /etc/ssh/ssh_host_ed25519_key

Then sshd -tcheck it with , and found that there is still an error, this time it is said that /etc/ssh/ssh_host_rsa_keythe permissions of this file are too high

Permissions 0744 for '/etc/ssh/ssh_host_rsa_key' are too open

same modification rights

chmod 600 /etc/ssh/etc/ssh/ssh_host_rsa_key

Missing privilege separation directory: /var/empty/sshd

Then sshd -tcheck it with , and it turns out that there is still an error, this time it is said

Missing privilege separation directory: /var/empty/sshd

 

The reason for this error is that when we start sshd, it will look for a symbolic link (soft link) for "localtime" and if it cannot find it, it will result in the following error message.

Starting sshd: Missing permission separation directory: /var/empty/sshd

mkdir -p /var/empty/sshd/etc
cd /var/empty/sshd/etc/
ln -s /etc/localtime localtime

 Finally, check with sshd -t and find that there is no problem. Check the service status of sshd. normal operation. problem solved

Summarize

Good day, start from solving the problem, okay, this is another blog post.

written in the back

If you find it useful, please support Siege Lion Baiyu with one button and three consecutive links , and share this article with more friends. Your simple support, my infinite creative power

 

 

 

Guess you like

Origin blog.csdn.net/zhh763984017/article/details/120111936