SFTP 用户应该只能访问 ChrootDirectory 中的子目录

SFTP 用户应该只能访问 ChrootDirectory 中的子目录

我的sshd_config文件配置如下:

Subsystem sftp internal-sftp
Match User shiv
ChrootDirectory /var/www/html/
ForceCommand internal-sftp -d /Sub_Directory
PasswordAuthentication yes
PermitTunnel no
AllowAgentForwarding no
AllowTcpForwarding no
X11Forwarding no

用户 shiv 能够连接,会话以 开始/Sub_Directory。当用户尝试访问目录/home/var/www/htmlFileZilla 上的远程站点地址栏时,它会显示错误“无法检索目录列表”这很好,我也想要一样。但是当用户/仅在远程站点地址栏中输入时,它会列出 html 文件夹的内容,而ChrootDirectory /var/www/html/我已经为该用户定义了一个目录,我希望当输入用户不应该能够访问该目录ForceCommand internal-sftp -d /Sub_Directory 时它应该显示错误。/

我只想使用 SFTP 来管理它。html 文件夹的所有者是root:root755。位于目录Sub_Directory内。html

相关内容