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

以后

就解决了。

相关文章
相关标签/搜索