SSH logon error: packet_write_wait: connection to x. x port 22: broken pipe

Source: Internet
Author: User
Tags keep alive openssh server root access
SSH logon error: packet_write_wait: connection to x. x port 22: broken pipe

References:

Https://patrickmn.com/aside/how-to-keep-alive-ssh-sessions/

 

After you connect to the server by using an SSH command, if you do not perform the operation for a period of time, when you enter terminal again, there will be no response for a period of time, and an error prompt will appear:

packet_write_wait: Connection to 47.92.226.106 port 22: Broken pipe

You can only use the SSH command to connect again.

 

Solution:

 

1. If you have multiple servers and do not want to set them on each server, you only need to set them on the client:

  • Keep all connections: (root access required), Edit/etc/ssh/ssh_config
  • Set: edit on your user only~/.ssh/config(Create the file if it doesn't exist)
Host *
  ServerAliveInterval 300
  ServerAliveCountMax 2

 

2. If there are multiple personal management servers, you can configure them on the server side:

Make your OpenSSH server keep alive all connections with clients by adding the following/etc/ssh/sshd_config:

ClientAliveInterval 300ClientAliveCountMax 2

 

These settings allow the SSH client or server to send an empty package to the other end every 5 minutes.

If it does not receive any response after two attempts, give up. The connection is disconnected.

 

Man ssu_config shows the detailed description:

SYNOPSIS     ~/.ssh/config     /etc/ssh/ssh_configDESCRIPTION     ssh(1) obtains configuration data from the following sources in the following     order:           1.   command-line options           2.   user‘s configuration file (~/.ssh/config)           3.   system-wide configuration file (/etc/ssh/ssh_config)

 

SSH logon error: packet_write_wait: connection to x. x port 22: broken pipe

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.