在父节点具有组写入权限的目录中设置一个chroot的SFTP用户

我有一个用户只有sftp权限(无ssh)和谁是在SFTP chrooted到/data/docker/data (这是一个单独的驱动器)有775个权限,我想保持这种方式。 但是,如果有对/data组写入访问权限,则在尝试以此用户身份login时出现此错误:

 Write failed: Broken pipe Connection closed 

我如何允许SFTP没有chmodding /data到755?

OpenSSH sshd_config手册非常清楚chroot目录的要求:

  ChrootDirectory Specifies the pathname of a directory to chroot(2) to after authentication. All components of the pathname must be root- owned directories that are not writable by any other user or group. 

如果你希望/data是模式0775,那么它不能成为SSH chroot文件夹path的一部分。

我认为用OpenSSH解决这个问题的方法是创build另一个path,如/chroot具有正确的权限。 使用绑定挂载 ,NFS或任何您的操作系统支持在新文件夹中挂载此/data/docker文件夹。 然后你将/chroot/docker设置为chroot文件夹。 用户应该能够通过/chroot/dockerpath访问/data/docker的内容。

或者,您可以在没有此限制的情况下构build并使用您自己的OpenSSH sshd副本。 或者你可以考虑使用不同的SFTP服务器。 JScape有一个商业产品,可能会做你想做的。