Linux系统下SSH服务启动失败故障处理

举报
江湖有缘 发表于 2023/04/04 12:34:52 2023/04/04
【摘要】 Linux系统下SSH服务启动失败故障处理

@TOC

一、系统版本

[root@localhost ~]# cat /etc/os-release 
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

二、报错状态

[root@localhost ~]# systemctl status sshd
● 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 Fri 2022-02-04 04:36:19 CST; 38s ago
     Docs: man:sshd(8)
           man:sshd_config(5)
  Process: 21131 ExecStart=/usr/sbin/sshd -D $OPTIONS (code=exited, status=1/FAILURE)
 Main PID: 21131 (code=exited, status=1/FAILURE)

Feb 04 04:36:19 localhost.localdomain sshd[21131]: Permissions 0640 for '/etc/ssh/ssh_host_ed25519_key' ...en.
Feb 04 04:36:19 localhost.localdomain sshd[21131]: It is required that your private key files are NOT ac...rs.
Feb 04 04:36:19 localhost.localdomain sshd[21131]: This private key will be ignored.
Feb 04 04:36:19 localhost.localdomain sshd[21131]: key_load_private: bad permissions
Feb 04 04:36:19 localhost.localdomain sshd[21131]: Could not load host key: /etc/ssh/ssh_host_ed25519_key
Feb 04 04:36:19 localhost.localdomain sshd[21131]: sshd: no hostkeys available -- exiting.
Feb 04 04:36:19 localhost.localdomain systemd[1]: sshd.service: main process exited, code=exited, status...URE
Feb 04 04:36:19 localhost.localdomain systemd[1]: Failed to start OpenSSH server daemon.
Feb 04 04:36:19 localhost.localdomain systemd[1]: Unit sshd.service entered failed state.
Feb 04 04:36:19 localhost.localdomain systemd[1]: sshd.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

三、处理方法

[root@localhost ssh]#chmod 600 /etc/ssh/ssh_host_ed25519_key
[root@localhost ssh]# systemctl restart sshd

四、查看服务状态

[root@localhost ssh]# systemctl status sshd
● sshd.service - OpenSSH server daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2022-02-04 05:18:48 CST; 1min 39s ago
     Docs: man:sshd(8)
           man:sshd_config(5)
 Main PID: 22158 (sshd)
    Tasks: 1
   CGroup: /system.slice/sshd.service
           └─22158 /usr/sbin/sshd -D

Feb 04 05:18:48 localhost.localdomain sshd[22158]: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Feb 04 05:18:48 localhost.localdomain sshd[22158]: @         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
Feb 04 05:18:48 localhost.localdomain sshd[22158]: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Feb 04 05:18:48 localhost.localdomain sshd[22158]: Permissions 0640 for '/etc/ssh/ssh_host_ecdsa_key' are too open.
Feb 04 05:18:48 localhost.localdomain sshd[22158]: It is required that your private key files are NOT accessible by others.
Feb 04 05:18:48 localhost.localdomain sshd[22158]: This private key will be ignored.
Feb 04 05:18:48 localhost.localdomain sshd[22158]: key_load_private: bad permissions
Feb 04 05:18:48 localhost.localdomain sshd[22158]: Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Feb 04 05:18:48 localhost.localdomain sshd[22158]: Server listening on :: port 22.
Feb 04 05:18:48 localhost.localdomain systemd[1]: Started OpenSSH server daemon.
[root@localhost ssh]# 


【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。