I try to run a rsync on a shared server that I have no control over the ssh-config file to prevent the broken pipe error because the connection drop.

Here's a snippet of the code I use to backup

rsync -avz --blocking-io --delete-after --exclude 'mail*' /home user@remote:./backup/monthly/

Using this works fine for around 10min. , the the broken pipe error appears to tell me I've lost connection... probably because the rsync run in an idle state over SSH so SSH thinks I don't do anything while the rsync is running.

I've tried with and without --blocking-io but the connection still drop. Are they any trick to keep the SSH session alive until the rsync is complete without having access to the ssh-config file?

This works providing your running OpenSSH.

Edit your ~/.ssh/config file and add the following to activate the keep-alive system for just your user for all host connected to.

If you want to do this just for one host, switch the * with a host name of your choosing.

Host *
    ServerAliveInterval 300
    ServerAliveCountMax 2

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.