Hi I am getting a really annoying SSH Putty Connection Timeout Issue which I can not fix

Happens when its running a command which is taking a while - some of the commands I run can take 2 hours or more to complete When it disconnects I can not see if the command completed or not.

I have a dedicated server centos 6 , 16gb ram - Apache 2.4 and Nginx PHP 5.6 and PHP 7.1 using with MultiPHP Manager PHP-FM - I have tried to increase some settings via WHM but not making any difference - can someone let me know which settings I should be looking to increase or change to fix this problem

  • 1
    i think running the command in background mode will solve that, you can do that by adding the & symbol to the end of the command – Mheni Aug 9 '19 at 18:42
  • Network Error Caused Connection Abort is what happens after it runs over 2 hours I will try the suggestion and update – jt9489 Aug 9 '19 at 20:02

Sounds as if changing the tcp_keepalive_time kernel keepalive setting may help.

Check the value (usually set to 7200 seconds) thus:

cat /proc/sys/net/ipv4/tcp_keepalive_time

and to increase the value do:

   echo 14400 > /proc/sys/net/ipv4/tcp_keepalive_time
  • This looks more like it as I did get 7200 when checking and it happens after 2 hours, I increased it as per your suggestion and will update thanks – jt9489 Aug 9 '19 at 22:25
  • I have tried the suggestion in the Answer however I see that now still the putty is getting disconnected and becomes un-useable fails to complete the task in the command - but only now there is not error display popup coming as before – jt9489 Aug 10 '19 at 22:16
  • You need a much, much lower number here, say 300. – Michael Hampton Aug 14 '19 at 4:26

i suggest using Linux screen sessions, they are made to solve this problem.

you basically

  • create a screen session and run your program
  • detach from the session if you don't need it, and even if you ssh connection breaks the screen session is still running
  • when you ssh back to the server you reattach to the screen session and find you results.

here is a link to a simple tutorial about screens.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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