Some time ago, I was explaining how to backup your important files using rsync and ssh. This solution allowed to transfer some content to your server in a secure way. Of course, I was using this solution myself, but I got some problems while using it due to SSH limitations with my webhost (webhostingbuzz). Indeed, after 30 minutes of connection, the SSH session was killed and therefore rsync that was using it got frozen.
After some researches on this Internet, I found some options to give to the SSH command to maintain a connection open with the server. Different solutions exist:
TCPKeepAlive=yes
. This is the default value so your client will send KeepAlive messages to the server but not through the SSH channel.ServerAliveInterval=15
. This specifies a time in second during which the client accept not to receives any answer for the server. It is multiplied by the ServerAliveCountMax parameter to give the total time after which your client will be considered disconnected from the server. The default value of ServerAliveCountMax is three so by specifyingServerAliveInterval=15
you allow your ssh session not to receive any answer during 45 seconds after which the session will be considered as lost. This ServerAlive messages are sent through the SSH channel.- Specify a command that SSH should use in the background to ensure
that there is activity between the client and the server. This is a
command like
while date ; do sleep 10 ; done
. For more information you can have a look at The Mad Philosopher.
But none of this options was working for me. So I decided to contact my webhost support and ask them how I could do my backup. I received an answer saying that indeed all SSH connections were closed every 30 minutes for security reason and that I could use FTP instead. In addition, my transfer was requiring too many resources so my account could get suspended. After many emails to try to find a solution, I decided to use FTP which shouldn’t have any time limit according to the support.
The problem with the use of FTP is that transfer is not secure, and that it becomes much harder to put exclusion rules. In addition, using rsync afterwards is not possible since file properties are not sent through ftp.
So, if you have or know any good host that allows unlimited ssh access, please leave a comment. It can be useful!
For the time being, comments are managed by Disqus, a third-party library. I will eventually replace it with another solution, but the timeline is unclear. Considering the amount of data being loaded, if you would like to view comments or post a comment, click on the button below. For more information about why you see this button, take a look at the following article.