Fixing ssh connection timeouts

Quick post on what to do if your ssh connects get killed too quickly when idle.

nn

My problem was that I would ssh into my Pi, step away for 2 minutes, and find that the connection was frozen when I returned. You can fix this by increasing the timeout value of your ssh connection.

nn

Two options to increase the timeout value:

nn

    n

  1. n

    In the ssh connection command

    nn

    ssh -o ServerAliveInterval=10 keepsdroppingme.com

    n

  2. n

  3. n

    In your personal remote ssh config

    nn

    # This is ~/.ssh/confign # For all hostsn ServerAliveInterval 10n # For a selection of hostsn Host keepsdroppingme.com alsokeepsdroppingme.com ServerAliveInterval 10

    n

  4. n

nn

Thanks to Quora for the help.

Leave a Reply

Your email address will not be published. Required fields are marked *