我想在我的服务器上配置 sftp 由 root 用户访问。
我将我的配置更改/etc/ssh/sshd_config为:
PermitRootLogin yes
AuthorizedKeysFile .ssh/authorized_keys
PermitEmptyPasswords yes
ChallengeResponseAuthentication no
Compression no
ClientAliveInterval 15
ClientAliveCountMax 4
#Other options are commented
[...]
Subsystem sftp /usr/libexec/sftp-server
Match user root
ChrootDirectory /
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp
Run Code Online (Sandbox Code Playgroud)
它可以工作,我可以通过 sftp 连接到我的服务器,但现在我可以再通过 ssh 连接。我收到这条消息:
This service allows sftp connections only.
同样的情况发生在Match group root
如何配置 sftp 以允许 root 但也保留 ssh?
Subsystem sftp /usr/libexec/sftp-server
Match user root
ChrootDirectory / …Run Code Online (Sandbox Code Playgroud)