使用 chroot 锁定 sftp 访问,无需 root 拥有文件夹

使用 chroot 锁定 sftp 访问,无需 root 拥有文件夹

我读到的所有内容都表明,要chroot使用该sftp root文件夹,就必须拥有该文件夹。我想让用户只能sftp访问其主文件夹中的子目录,例如/home/user/some/folder.显然罗

答案1

man 8 sftp-server, 看:

-d start_directory
         specifies an alternate starting directory for users.  The
         pathname may contain the following tokens that are expanded at
         runtime: %% is replaced by a literal '%', %d is replaced by the
         home directory of the user being authenticated, and %u is
         replaced by the username of that user.  The default is to use the
         user's home directory.  This option is useful in conjunction with
         the sshd_config(5) ChrootDirectory option.

相关内容