Open ssh error: packet_write_wait: Connection to x.x.x.x port 22: Broken pipe

11,343

Ok the issue seems to be I did not have permissions for /var/www, when I changed the permissions as shown in the guide I did that for /var/www/html. So when I ran this

cd /var/www
chown root:sftp .
chmod 755 .
chown -R sftpuser:sftp *

it worked. I also ran it again on /var/www/html just to be sure.

Share:
11,343
Hayden Mumm
Author by

Hayden Mumm

Updated on September 18, 2022

Comments

  • Hayden Mumm
    Hayden Mumm over 1 year

    First i am going to explain what I'm trying to do. I have set up a webserver running ubuntu server on top of vmware-esxi. I want to use SFTP over SSH to upload my website's code. We did this in a php class I took.

    I followed this guide.

    So I have a user named sftpuser and a group called sftp and when I try to connect it gives the error:

    packet_write_wait: Connection to x.x.x.x port 22: Broken pipe
    

    My ssh config looks this at the bottom, the rest is unchanged

    ClientAliveInterval 20
    ClientAliveCountMax 5
    
    TCPKeepAlive yes
    
    Match group sftp
    ChrootDirectory %h
    X11Forwarding no
    AllowTcpForwarding no
    ForceCommand internal-sftp
    

    I'm new to linux so I'm unsure what the cause could be. Thanks.

    Edit:

    The error in /var/log/auth.log is

    fatal: bad ownership of chroot directory component "/var/www"
    
    • ob2
      ob2 over 5 years
      Can you give the content of /var/log/auth.log from the server?