0

I'm trying to get sftp working with proper chroot configuration on Centos 6.5 server. As for now I get:

sftp user@000.000.000.000
User@000.000.000.000's password: 
Write failed: Broken pipe
Couldn't read packet: Connection reset by peer

In /var/log/messages I get:

Connection from 000.000.000.000 port 52365
Accepted password for User from 000.000.000.000 port 52365 ssh2
User child is on pid 0000
fatal: bad ownership or modes for chroot directory component "/"

User section in /etc/ssh/sshd_config:

Match User User
        X11Forwarding no
        AllowTcpForwarding no
        ChrootDirectory /sftp/user

Both /sftp and /sftp/user are set to root:root and 755. As I understand error message, chroot tries to use "/" as directory, instead of "/sftp/user". Why is it so? What may I do to fix it? Thanks for any ideas.

  • Can you share an output of ls -lad /? – Martin Prikryl Oct 23 '14 at 16:24
0
ls -lad /
rwxr-xr-x. 30 509 users 4096 Oct 23 13:56 /

Showed that root belongs to non existent user and users group. Simple chown fixed the problem.

chown root:root /

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.