Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
    
... Debian 2.0? –  grawity Jun 20 '10 at 12:22

4 Answers 4

up vote 1 down vote accepted

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.

share|improve this answer
    
Not allocating a pseudo-terminal seems to indeed prevent the auto-logout, at least in a first test. Thanks for the simple solution! BTW, I did tell you about the system. See my question. –  feklee Jun 21 '10 at 8:51

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.

share|improve this answer
    
Shell is bash. Not allocating a pseudo-terminal, as suggested by @mihi, does the trick. –  feklee Jan 8 '13 at 0:15

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
share|improve this answer

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 screen and arranging for an updating clock to be in the status bar as seen in this example. If that clock display doesn't update without user input, you could instead try split the screen session (ctrl+a, ctrl+S), resise the extra visible window very small (ctrl+a, :resize 2) and have in that which auto-updates like watch -n 10 date for instance.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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