美文网首页
记一次sshd无法启动问题排查笔记!

记一次sshd无法启动问题排查笔记!

作者: DragonersLi | 来源:发表于2021-07-21 11:57 被阅读0次

    xftpxshell等工具无法连服务器。连接失败提示:shell authentication failed!一开始想到可能sshd有问题要重启,只能通过阿里云后台的云助手发送命令。

    发送命令:service restart sshd 执行失败

    The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). 
    For other actions, please try to use systemctl.
    

    根据使用service restart sshd提示要使用/bin/systemctl restart sshd.service,执行后提示:

    Job for sshd.service failed because the control process exited with error code. 
    See "systemctl status sshd.service" and "journalctl -xe" for details.
    
    

    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 2021-07-21 11:04:42 CST; 9s ago
         Docs: man:sshd(8)
               man:sshd_config(5)
     Main PID: 27032 (code=exited, status=255)
    
    Jul 21 11:04:42 DragonersLi systemd[1]: Failed to start OpenSSH server daemon.
    Jul 21 11:04:42 DragonersLi systemd[1]: Unit sshd.service entered failed state.
    Jul 21 11:04:42 DragonersLi systemd[1]: sshd.service failed.
    

    本打算用宝塔修改/etc/ssh/sshd_config文件,打开密码登录。
    根据如上提示信息去百度:Failed to start OpenSSH server daemon.``sshd -t检查执行失败,提示如下:

    /etc/ssh/sshd_config line 142: Deprecated option RSAAuthentication
    /var/empty/sshd must be owned by root and not group or world-writable.
    

    经查/var/empty/sshd这个目录的属主不是root,所以启动ssh报错!应该是改动过/var目录的权限导致的!

    chown root /var/empty/sshd/  #更改目录为root所有
    或者:
    chown -R root.root /var/empty/sshd
    chmod 744 /var/empty/sshd
    然后重启sshd服务
    

    相关文章

      网友评论

          本文标题:记一次sshd无法启动问题排查笔记!

          本文链接:https://www.haomeiwen.com/subject/ujfarxtx.html