6

My ISP's SSH server (Debian 2.0) logs me out after 35 minutes of inactivity, when connected with PuTTY (Windows XP). This is a big problem when I utilize the server for port-forwarding. The final messages displayed in the terminal:

This terminal has been idle 30 minutes. If it remains idle
for 5 more minutes it will be logged out by the system.

Logged out by the system.

PuTTY options that do not help:

  • Sending of null packets to keep session active. Seconds between keepalives (0 to turn off): 30
  • [x] Enable TCP keepalives (SO_KEEPALIVE option)

Any idea how to avoid the auto-log-out? Should I try another SSH client?

Chenmunka
  • 3,264
feklee
  • 1,744

4 Answers4

2

When you need only port forwarding, you can try if you disable starting a shell at all, and disable allocating a pseudo-terminal. Then the terminal can no longer be idle. :-)

If your ISP does not allow this, you can run a script like this in your shell session

while sleep 60; do
    echo "Still there"
done

so that the terminal shows activity and it should not be logged out.

But it depends on the operating system they are using which option will help. You did not tell us, did you? uname -a is your friend.

mihi
  • 3,447
1

That looks like the server is enforcing the timeout at the protocol level, and explicitly ignoring the null packets often used to keep a connection alive despite such timeouts. Unfortunately that means there is probably little you can do via client options.

You could try arrange for something in the session to be constantly updating, perhaps by using byobu (or tmux or screen directly) and arranging for an updating clock to be in the status bar as is the default in most Linux distro's standard configurations of byobu.

If not using a screen display manager like that you could instead try run anything that auto-updates in the SSH session to keep it alive for the tunnels, such as watch -n 10 date.

1

Which shell are you using on the server?

You can try logging in without a shell at all, by ticking ConnectionSSHDon't start a shell or command at all, or you can try running a different shell and ensuring that it doesn't have an auto-logout feature enabled.

For example, try running tcsh and ensure that autologout is not set, by executing unset autologout.

cnst
  • 2,615
1

I have a simple AutoHotkey script to deal with any Telnet/SSH session opened from Windows. It might help somebody:

SetTitleMatchMode 2     ; 2 - partially, 3 - exact match
MyWinTitle=- PuTTY      ; Describe the window for keep alive signals
Timeout=180000          ; Call KeepAlive every 180 seconds (180000 ms)

ttl := Timeout / 1000
ToolTip, Keepalives every '%ttl%' seconds for the last touched '%MyWinTitle%' window`nTo stop the keepalive press F12
SetTimer, RemoveToolTip, 3000   ; Shows the tooltip for 5 seconds
return

RemoveToolTip:
    SetTimer, RemoveToolTip, Off    ; only once
    ToolTip
    Gosub, MyKeepAlive
Return

MyKeepAlive:
    WinGetActiveTitle, Title

    IfWinExist, %MyWinTitle%
    {
        WinActivate
        WinGet, mywin_id
        WinGetActiveTitle, mywin_title
        Send {!}{BS}
        MsgBox,,Info message, The window for keep-alives is '%mywin_title%',3
        WinActivate, %Title%
    }
    else
    {
        MsgBox,,Exit message, Open the window first!,10
        ExitApp
    }

    SetTimer, KeepAlive, %Timeout%
    Return

    KeepAlive:
        WinGetActiveTitle, Title
        WinGetTitle, current_title, ahk_id %mywin_id%

        If current_title = %mywin_title%
        {
            WinActivate, ahk_id %mywin_id%
            Send {!}{BS}
            WinActivate, %Title%
        }
        else
        {
            MsgBox,,Exit message, The window was closed!,10
            ExitApp
        }
    Return
Return

F12::ExitApp                ; Exit button
Mogget
  • 1,353
freealx
  • 11
  • 1