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












1















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"









share|improve this question




















  • 1





    Can you give the content of /var/log/auth.log from the server?

    – olivierb2
    Jan 15 at 9:17


















1















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"









share|improve this question




















  • 1





    Can you give the content of /var/log/auth.log from the server?

    – olivierb2
    Jan 15 at 9:17
















1












1








1








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"









share|improve this question
















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"






networking server 18.04 ssh sftp






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 15 at 18:21







Hayden Mumm

















asked Jan 15 at 7:40









Hayden MummHayden Mumm

63




63








  • 1





    Can you give the content of /var/log/auth.log from the server?

    – olivierb2
    Jan 15 at 9:17
















  • 1





    Can you give the content of /var/log/auth.log from the server?

    – olivierb2
    Jan 15 at 9:17










1




1





Can you give the content of /var/log/auth.log from the server?

– olivierb2
Jan 15 at 9:17







Can you give the content of /var/log/auth.log from the server?

– olivierb2
Jan 15 at 9:17












1 Answer
1






active

oldest

votes


















0














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|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1109840%2fopen-ssh-error-packet-write-wait-connection-to-x-x-x-x-port-22-broken-pipe%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    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|improve this answer




























      0














      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|improve this answer


























        0












        0








        0







        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|improve this answer













        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|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 16 at 18:31









        Hayden MummHayden Mumm

        63




        63






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1109840%2fopen-ssh-error-packet-write-wait-connection-to-x-x-x-x-port-22-broken-pipe%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

            ComboBox Display Member on multiple fields

            Is it possible to collect Nectar points via Trainline?