centos7 sftp設置後 ssh 啓動失敗 緣由分析

大多數人 在 設置SFTP 使用時,會在 ../sshd_config中添加以下內容:ssh

-------------------------------unix

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

------------------------------server

啓動時 報以下錯誤:it

-- 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,io

 

 

排除其餘可能的緣由,能夠嘗試以下:ftp

object

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

放在service

UseDNS no

以後

就解決了。

相關文章
相關標籤/搜索