URL: https://linuxfr.org/forums/linux-debian-ubuntu/posts/sftp-chroot Title: SFTP + Chroot Authors: zobbyzobba Date: 2012年07月02日T13:47:19+02:00 Tags: Score: 1 Bonjour à tous, Je galère à mettre en place du SFTP avec un chroot... J'ai suivi les tutos trouvés ici et là, mais j'ai toujours le même problème et je ne sais pas comment débugger :( J'ai un dossier /datas/chroot qui est mon dossier racine pour le chroot. J'ai configuré /etc/ssh/sshd_config de cette façon: [code] Port 22 Protocol 2 HostKey /etc/ssh/ssh_host_rsa_key HostKey /etc/ssh/ssh_host_dsa_key HostKey /etc/ssh/ssh_host_ecdsa_key UsePrivilegeSeparation yes KeyRegenerationInterval 3600 ServerKeyBits 768 SyslogFacility LOCAL6 LogLevel INFO LoginGraceTime 120 PermitRootLogin no StrictModes yes RSAAuthentication yes PubkeyAuthentication yes IgnoreRhosts yes RhostsRSAAuthentication no HostbasedAuthentication no PermitEmptyPasswords no ChallengeResponseAuthentication no X11Forwarding no X11DisplayOffset 10 PrintMotd no PrintLastLog yes TCPKeepAlive yes AcceptEnv LANG LC_* Subsystem sftp /usr/lib/openssh/sftp-server UsePAM yes[/code] Mon fichier /etc/rssh.conf: [code] logfacility = LOG_USER allowsftp umask = 022 chrootpath = "/datas/chroot" [/code] Contenu et droits de /datas/chroot: [code] ls -alR /datas/chroot/ /datas/chroot/: total 36 drwxr-x--- 8 root tout_le_monde 4096 juil. 2 10:37 . drwxr-xr-x 6 root root 4096 juin 29 14:33 .. drwxr-xr-x 3 root root 4096 juin 29 16:27 datas drwxr-xr-x 2 root root 4096 juil. 2 10:37 dev drwxr-xr-x 3 root root 4096 juil. 2 10:37 etc drwxr-xr-x 3 root root 4096 juil. 2 10:37 lib drwxr-xr-x 2 root root 4096 juil. 2 10:37 lib64 drwxr-xr-x 4 root root 4096 juil. 2 10:37 usr /datas/chroot/datas: total 12 drwxr-xr-x 3 root root 4096 juin 29 16:27 . drwxr-x--- 8 root tout_le_monde 4096 juil. 2 10:37 .. drwxr-xr-x 2 test test 4096 juil. 2 10:00 test /datas/chroot/datas/test: total 20 drwxr-xr-x 2 test test 4096 juil. 2 10:00 . drwxr-xr-x 3 root root 4096 juin 29 16:27 .. -rw-r--r-- 1 test test 220 juin 29 16:25 .bash_logout -rw-r--r-- 1 test test 3590 juin 29 16:25 .bashrc -rw-r--r-- 1 test test 675 juin 29 16:25 .profile /datas/chroot/dev: total 8 drwxr-xr-x 2 root root 4096 juil. 2 10:37 . drwxr-x--- 8 root tout_le_monde 4096 juil. 2 10:37 .. srw-rw-rw- 1 root root 0 juil. 2 09:54 log crw-rw-rw- 1 root root 1, 3 juil. 2 09:54 null crw-rw-rw- 1 root root 1, 5 juil. 2 09:54 zero /datas/chroot/etc: total 76 drwxr-xr-x 3 root root 4096 juil. 2 10:37 . drwxr-x--- 8 root tout_le_monde 4096 juil. 2 10:37 .. -rw-r--r-- 1 root root 53157 juil. 2 10:37 ld.so.cache -rw-r--r-- 1 root root 34 juil. 2 10:37 ld.so.conf drwxr-xr-x 2 root root 4096 juil. 2 10:37 ld.so.conf.d -rw-r--r-- 1 root root 475 juil. 2 10:37 nsswitch.conf -rw-r--r-- 1 root root 1812 juil. 2 10:37 passwd /datas/chroot/etc/ld.so.conf.d: total 24 drwxr-xr-x 2 root root 4096 juil. 2 10:37 . drwxr-xr-x 3 root root 4096 juil. 2 10:37 .. lrwxrwxrwx 1 root root 40 juil. 2 10:37 i386-linux-gnu_GL.conf -> /etc/alternatives/i386-linux-gnu_gl_conf -rw-r--r-- 1 root root 108 juil. 2 10:37 i686-linux-gnu.conf -rw-r--r-- 1 root root 44 juil. 2 10:37 libc.conf -rw-r--r-- 1 root root 68 juil. 2 10:37 x86_64-linux-gnu.conf lrwxrwxrwx 1 root root 42 juil. 2 10:37 x86_64-linux-gnu_GL.conf -> /etc/alternatives/x86_64-linux-gnu_gl_conf -rw-r--r-- 1 root root 56 juil. 2 10:37 zz_i386-biarch-compat.conf /datas/chroot/lib: total 12 drwxr-xr-x 3 root root 4096 juil. 2 10:37 . drwxr-x--- 8 root tout_le_monde 4096 juil. 2 10:37 .. drwxr-xr-x 2 root root 4096 juil. 2 10:37 x86_64-linux-gnu /datas/chroot/lib/x86_64-linux-gnu: total 1772 drwxr-xr-x 2 root root 4096 juil. 2 10:37 . drwxr-xr-x 3 root root 4096 juil. 2 10:37 .. -rwxr-xr-x 1 root root 1802936 juil. 2 10:37 libc.so.6 /datas/chroot/lib64: total 156 drwxr-xr-x 2 root root 4096 juil. 2 10:37 . drwxr-x--- 8 root tout_le_monde 4096 juil. 2 10:37 .. -rwxr-xr-x 1 root root 149280 juil. 2 10:37 ld-linux-x86-64.so.2 /datas/chroot/usr: total 16 drwxr-xr-x 4 root root 4096 juil. 2 10:37 . drwxr-x--- 8 root tout_le_monde 4096 juil. 2 10:37 .. drwxr-xr-x 2 root root 4096 juil. 2 10:37 bin drwxr-xr-x 4 root root 4096 juil. 2 10:37 lib /datas/chroot/usr/bin: total 100 drwxr-xr-x 2 root root 4096 juil. 2 10:37 . drwxr-xr-x 4 root root 4096 juil. 2 10:37 .. -rwxr-xr-x 1 root root 27096 juil. 2 10:37 rssh -rwxr-xr-x 1 root root 63552 juil. 2 10:37 scp /datas/chroot/usr/lib: total 16 drwxr-xr-x 4 root root 4096 juil. 2 10:37 . drwxr-xr-x 4 root root 4096 juil. 2 10:37 .. drwxr-xr-x 2 root root 4096 juil. 2 10:37 openssh drwxr-xr-x 2 root root 4096 juil. 2 10:37 rssh /datas/chroot/usr/lib/openssh: total 72 drwxr-xr-x 2 root root 4096 juil. 2 10:37 . drwxr-xr-x 4 root root 4096 juil. 2 10:37 .. -rwxr-xr-x 1 root root 63552 juil. 2 10:37 sftp-server /datas/chroot/usr/lib/rssh: total 36 drwxr-xr-x 2 root root 4096 juil. 2 10:37 . drwxr-xr-x 4 root root 4096 juil. 2 10:37 .. -rwxr-xr-x 1 root root 27120 juil. 2 10:37 rssh_chroot_helper[/code] Mon /etc/passwd: [code]test:x:1011:1012:,,,:/datas/chroot/datas/test:/usr/bin/rssh[/code] Bref, et donc quand j'essaie de me connecter la session se ferme toute seule sans message d'erreur: [code]sftp test@monserv test@monserv's password: Connection closed [/code] Et dans /var/log/syslog j'ai: [code] Jul 2 10:38:49 monserv sshd[4164]: Accepted password for test from 10.1.220.xxx port 50495 ssh2 Jul 2 10:38:54 monserv sshd[4307]: subsystem request for sftp by user test Jul 2 10:38:54 monserv rssh[4308]: setting log facility to LOG_USER Jul 2 10:38:54 monserv rssh[4308]: allowing sftp to all users Jul 2 10:38:54 monserv rssh[4308]: setting umask to 022 Jul 2 10:38:54 monserv rssh[4308]: chrooting all users to /datas/chroot Jul 2 10:38:54 monserv rssh[4308]: chroot cmd line: /usr/lib/rssh/rssh_chroot_helper 2 "/usr/lib/openssh/sftp-server" Jul 2 10:38:54 monserv sshd[4307]: Received disconnect from 10.1.220.xxx: 11: disconnected by user [/code] Est-ce que quelqu'un saurait m'aider? ou au moins m'expliquer comment avec des logs où l'on pourrait voir les erreurs ? Merci d'avance :) Bonne journée, zobbyzobba

AltStyle によって変換されたページ (->オリジナル) /