Ограничьте пользователей sftp доступом только

Я хочу заключить в тюрьму группу пользователей с доступом только к a /var/www/mysitename.com шаблон каталога через sftp один. Я не хочу обеспечивать доступ оболочки также.

1
задан 11 October 2014 в 07:53

1 ответ

Можно попробовать что-то как:

Match Group group-name
    ForceCommand internal-sftp
    ChrootDirectory /var/www/mysitename.com

в /etc/ssh/sshd_config.

Из страницы справочника:

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.  After the chroot, sshd(8) changes the working directory
         to the user's home directory. [...]

 ForceCommand
         Forces the execution of the command specified by ForceCommand,
         ignoring any command supplied by the client and ~/.ssh/rc if
         present.  [...] Specifying a command of “internal-sftp” will 
         force the use of an in-process sftp server that requires no 
         support files when used with ChrootDirectory.

Эти условия требуют что:

  1. Каждый каталог в пути /var/www/mysitename.com должен принадлежать корню, и не перезаписываемый другими или корнем.
  2. у Всех пользователей в этой группе есть корневой каталог / (корень), или эти chroot перестанет работать.

Поочередно, можно установить ChrootDirectory на /var/www и установить корневые каталоги всех этих пользователей к /mysitename.com.

Соответствующее чтение:

2
ответ дан 11 November 2019 в 09:31

Другие вопросы по тегам:

Похожие вопросы: