When using ssh to connect to a server, you may get disconnected after leaving a terminal window idle for some period and receive an error message such as, "Write failed: Broken pipe.
" In order to prevent this from occurring, it is possible to configure ssh to send a null packet from your client machine to the server at regular intervals to prevent the session from becoming idle and being disconnected.
If you are using MacOS or Linux on your local client machine, you can instruct ssh to send a null packet from the client to the server at periodic intervals by setting the ServerAliveInterval
option in the ssh configuration file:touch ~/.ssh/config
echo "ServerAliveInterval 60" >> ~/.ssh/config
This should configure ssh to send a null packet from the client to the server every 60 seconds to prevent the connection from becoming idle.