首页服务器Web服务器 SSH启动失败解决方法

SSH启动失败解决方法

VPS是3个人合租共用的,不知道谁操作了什么导致SSH启动失败,一直连接不上刚开始以为系统坏了呢,后面通过VPS终端登陆上去发现SSH服务没在运行,于是尝试运行SSHD发现出现如下错误…

VPS是3个人合租共用的,不知道谁操作了什么导致SSH启动失败,一直连接不上刚开始以为系统坏了呢,后面通过VPS终端登陆上去发现SSH服务没在运行,于是尝试运行SSHD发现出现如下错误:

Starting sshd:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@        WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0777 for ‘/etc/ssh/ssh_host_rsa_key’ are too open.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: /etc/ssh/ssh_host_rsa_key
Could not load host key: /etc/ssh/ssh_host_rsa_key
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@        WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0777 for ‘/etc/ssh/ssh_host_dsa_key’ are too open.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: /etc/ssh/ssh_host_dsa_key
Could not load host key: /etc/ssh/ssh_host_dsa_key
Disabling protocol version 2. Could not load host key
sshd: no hostkeys available — exiting.
                                                            [FAILED]

解决方法:
#chmod 600 sshd_config ssh_host_dsa_key ssh_host_key ssh_host_rsa_key
#chmod 620 moduli
#chmod 644 ssh_config ssh_host_dsa_key.pub ssh_host_key.pub ssh_host_rsa_key.pub
#service sshd start

再次出现如下错误:
[root@bailongjun ssh]# service sshd restart
Stopping sshd:                                              [FAILED]
Starting sshd: /var/empty/sshd must be owned by root and not group or world-writable.
                                                            [FAILED]

  在终端上直接登录,问题显示如下:
  /var/empty/sshd must be owned by root and not group or world-writable.

  问题:

  Linux上的SSH无法启动

  报告/var/empty/sshd must be owned by root and not group or world-writable.

  解决办法:

  首先通过物理终端进入到linux上,手工检查ssh发现没运行

  -bash-2.05b# /etc/init.d/sshd status

  sshd is stopped

  手工启动服务,发现报告权限错误。

  -bash-2.05b# /etc/init.d/sshd start

  Starting sshd:/var/empty/sshd must be owned by root and not group or world-writable.

  [FAILED]

  -bash-2.05b#

  使用rpm -V 命令可检查到ssh的软件包正常,但某个目录的属主错误。

  -bash-2.05b# rpm -V openssh-server

  S.5….. c /etc/ssh/sshd_config

  …..U.. /var/empty/sshd

  -bash-2.05b#

  经查看发现这个目录的属主不是root,所以启动ssh报错

  -bash-2.05b# ls -ld /var/empty/sshd/

  d–x–x–x 2 vu00106 root 1024 Feb 2 2005 /var/empty/sshd/

  -bash-2.05b#

  修改为root属主,启动成功

  -bash-2.05b# chown root /var/empty/sshd/

  -bash-2.05b# /etc/init.d/sshd start

  Starting sshd: [ OK ]

  -bash-2.05b#

  至此问题修复。

  另外,还可以尝试:

  这个是权限的问题

  可采取以下两步解决

  chown -R root.root /var/empty/sshd

  chmod 744 /var/empty/sshd

  service sshd restart

  就可以解决上述的问题。

本文来自网络,不代表1号站长-站长学院|资讯交流平台立场。转载请注明出处: https://www.1cn.cc/fwq/web/4795.html
上一篇如何恢复iptables的默认设置
下一篇 N点虚拟主机系统安装和配置教程
admin

作者: admin

这里可以再内容模板定义一些文字和说明,也可以调用对应作者的简介!或者做一些网站的描述之类的文字或者HTML!

为您推荐

评论列表()

    联系我们

    联系我们

    0898-88888888

    在线咨询: QQ交谈

    邮箱: email@wangzhan.com

    工作时间:周一至周五,9:00-17:30,节假日休息

    关注微信
    微信扫一扫关注我们

    微信扫一扫关注我们

    关注微博
    返回顶部