Suddenly my SFTP server that jails use to their home directory started giving the following error

packet_write_wait: Connection to ::1 port 22: Broken pipe Couldn't read packet: Connection reset by peer

In the log file from server side, this is what I am getting

Apr 26 15:33:06 netmon1ch sshd[866]: Accepted password for test from ::1 port 46444 ssh2

Apr 26 15:33:06 netmon1ch sshd[866]: fatal: bad ownership or modes for chroot directory component "/tmp/" [postauth]

Here is our SFTP configuration for sample user here:

Subsystem       sftp    internal-sftp
Match User test
ChrootDirectory %h
ForceCommand internal-sftp
X11Forwarding no
AllowTcpForwarding no

The user account

test:x:1000:1000::/tmp/test/:/bin/false

The directory

drwxr-x--- 2 root test 6 Apr 26 08:59 /tmp/test/

And output of the connection attempt

debug2: we did not send a packet, disable method debug1: Next authentication method: publickey debug1: Offering RSA public key: /root/.ssh/id_rsa debug2: we sent a publickey packet, wait for reply debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password debug1: Trying private key: /root/.ssh/id_dsa debug1: Trying private key: /root/.ssh/id_ecdsa debug1: Trying private key: /root/.ssh/id_ed25519 debug2: we did not send a packet, disable method debug1: Next authentication method: password test@localhost's password: debug2: we sent a password packet, wait for reply debug1: Authentication succeeded (password). Authenticated to localhost ([::1]:22). debug2: fd 4 setting O_NONBLOCK debug1: channel 0: new [client-session] debug2: channel 0: send open debug1: Requesting no-more-sessions@openssh.com debug1: Entering interactive session. debug1: pledge: network packet_write_wait: Connection to ::1 port 22: Broken pipe Couldn't read packet: Connection reset by peer

  • What are permissions for /tmp/ ? – AlexD Apr 26 at 15:00
  • And ofcourse it had write permissions of the other. After I removed it , it worked. I overlooked this :) – luupi Apr 27 at 6:24

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.