Smokes your problems, coughs fresh air.

Adding a clock in screen to avoid your ssh’s from being killed

The world is filled with stupid routers, which kill all connections that have no activity for a while (even a very short while). I keep loosing my SSH sessions because of this. To fix it, I added a clock in my GNU screen bar:

hardstatus alwayslastline "%= %H | %l | [%c:%s]"

For the record, my entire .screenrc:

multiuser on
caption always "%{= kB}%-Lw%{=s kB}%50>%n%f* %t %{-}%+Lw%<"
vbell off
startup_message off
term linux
hardstatus alwayslastline "%= %H | %l | [%c:%s]"

5 Comments

  1. Rowan Rodrik

    Screenshot or it didn’t happen. 😉

  2. halfgaar

    Blog with working image upload, or it didn’t happen 🙂 (or did you finally fix that…?

  3. Rowan Rodrik

    Working image uploads. It just happened.

  4. YC

    Alternatively you could set a ServerAliveInterval in .ssh/config so that it kind of sends a heartbeat signal if your connection is idle.

  5. halfgaar

    How does that play with momentary connection dropouts? Because the server option TCPKeepAlive says this:

    However, this means that connections will die if the route is down temporarily

    man ssh_config doesn’t say such a thing about ServerAliveInterval, so I guess it’s fine.

© 2024 BigSmoke

Theme by Anders NorenUp ↑