Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这是设置 sshd_config:
匹配用户 sftp Chroot 目录 /chroot/sftp
我可以很好地连接到文件夹
/chroot/sftp
但是我无法访问网站开发者文件夹,因为它超出了定义的 chroot 目录的范围
/usr/lib/apache2/htdocs
我怎样才能访问这个目录?是否可以通过 sshd_config 定义访问权限?
这正是您在使用 chroot 时所要求的行为。我认为您无法在 sshd_config 中解决此问题,但您可能会考虑两个选项:
1) 更改 Apache 的文档根目录,使其位于 /chroot/sftp 中。这将在您的 Apache 配置中完成。2) 在 /chroot/sftp 中挂载 htdocs 目录。像这样的东西:
mount --bind /usr/lib/apache2/htdocs /chroot/sftp
我对那个命令不是 100% 有信心,但理论就在那里。