Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Réseaux] SFTP et CHROOT (résolu)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index French
View previous topic :: View next topic  
Author Message
Thom1
n00b
n00b


Joined: 01 Jun 2008
Posts: 4

PostPosted: Mon Sep 29, 2008 9:31 am    Post subject: [Réseaux] SFTP et CHROOT (résolu) Reply with quote

Bonjour,

Je souhaite créer un serveur ssh avec sftp+chroot en utilisant openssh-5.x
J'ai donc crée un group sftp et un utilisateur test :
Code:
cletus ~ # grep sftp /etc/group
sftp:x:300:

cletus ~ # grep test /etc/passwd
test:x:3001:300::/test:/bin/bash

J'ai modifié mon sshd_config en ajoutant ceci :
Code:
Match group sftp
   X11Forwarding no
   AllowTcpForwarding no
   ForceCommand internal-sftp
   ChrootDirectory /sftp

J'ai crée correctement (je suppose) les répertoires avec les bons droits :
Code:
cletus ~ # ls -ld /sftp/
drwxrwxr-x 4 root sftp 4096 sep 29 11:18 /sftp/

cletus ~ # ls -ld /sftp/test/
drwxr-xr-x 2 test sftp 4096 sep 29 11:18 /sftp/test/

Et lorsque je me connecte depuis un autre PC (en lan), j'ai ceci :
Code:
homer:~ $ sftp test@cletus 
Connecting to cletus...
Password:
Read from remote host cletus: Connection reset by peer
Couldn't read packet: Connection reset by peer

cletus ~ # cat /var/log/messages
Sep 29 11:22:09 cletus sshd[24028]: Accepted keyboard-interactive/pam for test from 192.168.0.3 port 37491 ssh2
Sep 29 11:22:09 cletus sshd[24028]: pam_unix(sshd:session): session opened for user test by (uid=0)
Sep 29 11:22:09 cletus sshd[24032]: fatal: bad ownership or modes for chroot directory "/sftp"
Sep 29 11:22:09 cletus sshd[24028]: pam_unix(sshd:session): session closed for user test

Je suppose donc un problème de droit, mais je ne vois pas lequel.

Merci d'avance de votre réponse.


Last edited by Thom1 on Mon Sep 29, 2008 10:24 am; edited 2 times in total
Back to top
View user's profile Send private message
Thom1
n00b
n00b


Joined: 01 Jun 2008
Posts: 4

PostPosted: Mon Sep 29, 2008 9:35 am    Post subject: Reply with quote

Réponse à moi-même :
Seul root doit avoir accès au rep des users chrooté
Back to top
View user's profile Send private message
Enlight
Advocate
Advocate


Joined: 28 Oct 2004
Posts: 3519
Location: Alsace (France)

PostPosted: Mon Sep 29, 2008 3:47 pm    Post subject: Reply with quote

Thom1 wrote:
Réponse à moi-même :
Seul root doit avoir accès au rep des users chrooté


Pire même, ce doit être le cas pour tous les répertoires ancetres de celui du chroot, ça m'a presque couté une nuit de sommeil ce truc.
Back to top
View user's profile Send private message
Delvin
Guru
Guru


Joined: 07 Jul 2004
Posts: 546

PostPosted: Tue Sep 30, 2008 12:10 pm    Post subject: Reply with quote

Bonjour, je dois mettre en place un sftp chrooté, mais le USE chroot sur openssh est en (-chroot), comment je pourrais l'activer ?
J'ai cherché sur le wiki mais je n'ai rien trouvé.

Merci.
_________________
Ne tirez pas sur les canards !!
Back to top
View user's profile Send private message
Thom1
n00b
n00b


Joined: 01 Jun 2008
Posts: 4

PostPosted: Tue Sep 30, 2008 2:57 pm    Post subject: Reply with quote

Pour OpenSSH-5, il n'y a plus de USE=chroot puisque c'est inclus de base
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index French All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum