0

When I connected to Ubuntu server via SSH connection and run script which downloads a lot of images, its quitting ssh connection after few seconds with error: "Write failed: Broken pipe". Then I can reconnect to server easily, but server cannot download anything from the internet for few hours. Note that, script runs without any problems on my local pc. I thought that problem in hosting provider, but they said that they don't limit anything. Could it be limit on bandwidth from internet provider or I can increase bandwidth on server manually?

1 Answer 1

0

On the client machine, edit /etc/ssh/ssh_config and set the following values:

Host *
ServerAliveInterval 60

This will send a keepalive message to the server every 60 seconds. Adjust this value lower if necessary.

If you don't want to edit the config, you can adjust the ServerAliveInterval at the time of the SSH connection by passing parameters like so:

ssh -o ServerAliveInterval=60 -o ServerAliveCountMax=1 myserver.example.com

The other option is after a normal SSH connection is established, always execute long running scripts inside of a tmux or screen session.

3
  • Actual problem is not in ssh connection, I can just reconnect to server. I mentioned it to make situation more clear. Problem is that, after running script server cannot connect to internet for few hours. Jul 19, 2015 at 2:15
  • If it works locally but your SSH connection is getting killed with the broken pipe message, what happens when you try running it inside tmux session? Are you running the script as a background process, if so is it still running after you reconnect? Does pinging or DNS lookups of domains work at all? Does a restart of the server fix the Internet connection issue? Is the script using wget or curl to download? Please provide more details about the script.
    – beaorn
    Jul 19, 2015 at 2:22
  • Yes i run it at background, after i reconnect script is stopped, because there is no internet. No I cannot ping, ftp and http protocols also not working. Restarting of server not helping. Script using simple wget. Jul 19, 2015 at 3:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .