У меня есть сервер Debian, и я хочу предоставить нескольким пользователям доступ только для чтения к поддереву папок на этом сервере. Есть ли способ сделать это, не меняя вручную права всех файлов и папок?
Если вы действительно хотите максимально ограничить их, я предлагаю взглянуть на chrooted ssh install. Таким образом, даже если им удастся сломать свое дерево, они не смогут обходить основную систему.
У ребят из Debian есть руководство по этой теме.
rssh делает именно это. С сайта pizzashack.org:
rssh - это оболочка с ограниченным доступом для использования с OpenSSH, допускающая только scp и / или sftp. Теперь он также включает поддержку rdist, rsync и cvs. Например, если у вас есть сервер, с которого вы хотите разрешить пользователям копировать файлы только через scp, без предоставления доступа к оболочке, вы можете использовать rssh для этого. Список платформ, на которых известно, что rssh работает, см. На странице поддержки платформы.
исходный (из openbsd) sshd может выполнять полный chroot, цитируя sshd_config:
ChrootDirectory
Specifies a path to chroot(2) to after authentication. This
path, and all its components, must be root-owned directories that
are not writable by any other user or group. After the chroot,
sshd(8) changes the working directory to the user's home directo-
ry.
The path may contain the following tokens that are expanded at
runtime once the connecting user has been authenticated: %% is
replaced by a literal '%', %h is replaced by the home directory
of the user being authenticated, and %u is replaced by the user-
name of that user.
The ChrootDirectory must contain the necessary files and directo-
ries to support the user's session. For an interactive session
this requires at least a shell, typically sh(1), and basic /dev
nodes such as null(4), zero(4), stdin(4), stdout(4), stderr(4),
arandom(4) and tty(4) devices. For file transfer sessions using
``sftp'', no additional configuration of the environment is nec-
essary if the in-process sftp server is used, though sessions
which use logging do require /dev/log inside the chroot directory
(see sftp-server(8) for details).
The default is not to chroot(2).