Страница 1 из 1

sftp+chroot пару вопросов

Добавлено: 2011-06-10 20:33:25
Beos
Сделал вот такую системку по мануалу: http://www.lissyara.su/articles/freebsd ... tp+chroot/

Всё работает, но хочу понять 2 момента:

1) люди пишут в комментариях
У меня заработало только после установки

Subsystem sftp internal-sftp
вместо
Subsystem sftp /usr/local/libexec/sftp-server
а у меня и без этого работает ... т.е. у меня стоит "Subsystem sftp /usr/libexec/sftp-server" (релоад делал)

2) мне конечно так и надо, что бы юзеры не заходили через SSH... Но почему после действий из мануала блокируется доступ к SSH? Вроде бы специально для этого мы ничего не делали и в логах пусто :O

P.S. 8.1-RELEASE

Re: sftp+chroot пару вопросов

Добавлено: 2011-06-12 17:06:02
Beos
Ладно про первый пункт все понятно, а вот почему пользователь с шелом не может зайти по ssh?

Re: sftp+chroot пару вопросов

Добавлено: 2011-06-12 18:29:55
bagas
Попробуй добавить разрешить этого пользователя под которых заходишь.
AllowUsers user@user.org

Re: sftp+chroot пару вопросов

Добавлено: 2011-06-15 20:24:07
Beos
bagas писал(а):Попробуй добавить разрешить этого пользователя под которых заходишь.
AllowUsers user@user.org
Если бы этого небыло - я бы даже на SFTP не зашел бы. Это все прописано (юзер-герой вопроса в группе hosting_sftp):

Код: Выделить всё

AllowGroups wheel hosting_sftp

Match group hosting_sftp
        ChrootDirectory %h
        ForceCommand internal-sftp
        AllowTcpForwarding no
        X11Forwarding no
Сейчас немного поэкспериментировал, короче настройка "ChrootDirectory" для группы "hosting_sftp" - чрутит юзера в SFTP и одновременно отрубает SSH доступ.

Вот что говорит мануал:

Код: Выделить всё

[b]ChrootDirectory[/b]
	     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.

	     The pathname 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).
Я так понял что SSH перестал работать т.к. нету всяких бинов и т.д. а сам пользователь из создать не может т.е. права у нас это ему не позволят сделать через SFTP.

я прав? :Search: