SSH Error: write failed: broken pipe [Three Methods to Solve]

Problem scenario

Server environment: cloud Linux CentOS host

Client: Mac OSX terminal

Problem phenomenon

After connecting to the server with SSH command, if you do not operate for a period of time, you will not respond for a period of time when entering terminal again, and then an error prompt will appear:

Write failed: Broken pipe

You can only reconnect with the SSH command.


Method 1: if you have multiple servers and do not want to set them on each server, just add the config file in the ~ /. SSH/folder of the client and add the following configuration:

ServerAliveInterval 60

Method 2: if you have more than one person managing the server, you don’t want to set it on each client, just set it on/etc/SSH/sshd of the server_ Add the following configuration to config:

ClientAliveInterval 60

Method 3: if you only want to keep the current SSH connected, you can use the following command:

$ ssh -o ServerAliveInterval=60 [email protected]

Similar Posts: