• centos7 sftp设置后 ssh 启动失败 原因分析


    大多数人 在 设置SFTP 使用时,会在 ../sshd_config中添加如下内容:

    -------------------------------

    Subsystem sftp internal-sftp
    Match Group sftp
    ChrootDirectory /data
    ForceCommand internal-sftp
    AllowTcpForwarding no
    X11Forwarding no

    ------------------------------

    启动时 报如下错误:

    -- Unit sshd.service has begun starting up.
    2月 07 16:49:31 soc26 sshd[2074]: /etc/ssh/sshd_config line 147: Directive 'Subsystem' is not allowed within a Match block
    2月 07 16:49:31 soc26 systemd[1]: sshd.service: control process exited, code=exited status=255
    2月 07 16:49:31 soc26 systemd[1]: Failed to start OpenSSH server daemon.
    -- Subject: Unit sshd.service has failed
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    --
    -- Unit sshd.service has failed.
    --
    -- The result is failed.
    2月 07 16:49:31 soc26 systemd[1]: Unit sshd.service entered failed state.
    2月 07 16:49:31 soc26 systemd[1]: sshd.service failed.
    2月 07 16:49:31 soc26 polkitd[1295]: Unregistered Authentication Agent for unix-process:2067:361270 (system bus name :1.27, object path /org/freedesktop/PolicyKit1/AuthenticationAgent,
    2月 07 16:49:46 soc26 polkitd[1295]: Registered Authentication Agent for unix-process:2084:362757 (system bus name :1.28 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /or
    2月 07 16:49:46 soc26 systemd[1]: Cannot add dependency job for unit microcode.service, ignoring: Unit is not loaded properly: Invalid argument.
    2月 07 16:49:46 soc26 systemd[1]: Starting OpenSSH server daemon...
    -- Subject: Unit sshd.service has begun start-up
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    --
    -- Unit sshd.service has begun starting up.
    2月 07 16:49:46 soc26 sshd[2090]: /etc/ssh/sshd_config line 153: Directive 'UseDNS' is not allowed within a Match block
    2月 07 16:49:46 soc26 systemd[1]: sshd.service: control process exited, code=exited status=255
    2月 07 16:49:46 soc26 systemd[1]: Failed to start OpenSSH server daemon.
    -- Subject: Unit sshd.service has failed
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    --
    -- Unit sshd.service has failed.
    --
    -- The result is failed.
    2月 07 16:49:46 soc26 systemd[1]: Unit sshd.service entered failed state.
    2月 07 16:49:46 soc26 systemd[1]: sshd.service failed.
    2月 07 16:49:46 soc26 polkitd[1295]: Unregistered Authentication Agent for unix-process:2084:362757 (system bus name :1.28, object path /org/freedesktop/PolicyKit1/AuthenticationAgent,

    排除其他可能的原因,可以尝试如下:

    Subsystem sftp internal-sftp
    Match Group sftp
    ChrootDirectory /data
    ForceCommand internal-sftp
    AllowTcpForwarding no
    X11Forwarding no

    放在

    UseDNS no

    之后

    就解决了。

  • 相关阅读:
    SynchronousQueue 的联想
    Spring Cache
    CSUOJ 1011 Counting Pixels
    CSUOJ 1973 给自己出题的小X DFS
    CSUOJ 1726 你经历过绝望吗?两次!BFS+优先队列
    CSUOJ 1900 锋芒不露
    CSUOJ 1808 地铁
    CSUOJ 1895 Apache is late again
    CSUOJ 1781 阶乘除法
    CSUOJ 1560 图书管理员的表白方式
  • 原文地址:https://www.cnblogs.com/glaivelee/p/6374975.html
Copyright © 2020-2023  润新知