8

Nearly daily, I resume my computer to (correctly) find half a dozen or more dead PuTTY sessions left over from the previous day of administration. It's usually easier to clear my stack by closing all the inactive terminals and opening new PuTTY terminals as needed.

However, because of a modal "PuTTY Fatal Error" dialog, I am unable to bulk-close the group from the Windows taskbar. I have to manually go through each one, close the dialog, then close the window.

enter image description here

Is there a PuTTY option to disable this dialog? The titlebar appends "(Inactive)" to the ended sessions, which is good enough for me. A bonus would be still having the "Are you sure you want to close this session?" dialog, if possible.

jimp
  • 638
  • 3
  • 11
  • 20

4 Answers4

9

You can't really suppress these dialogs directly in Putty, I'm afraid. You can, however, work around the issue by using the command-line version of putty (plink) instead of the windowed version.

Another option would be to download the source code and either simply suppress the message or add support for a new /quiet switch that will do that (after all, putty is open source).

Edit: if you open the "WINDOWS\WIDNOWS.C" file and comment line 1111 (on my version anyway), that error message will be suppressed (not very elegant, but quick and easy). Here is the result:

/*
 * Print a message box and close the connection.
 */
void connection_fatal(void *frontend, char *fmt, ...)
{
    va_list ap;
    char *stuff, morestuff[100];

    va_start(ap, fmt);
    stuff = dupvprintf(fmt, ap);
    va_end(ap);
    sprintf(morestuff, "%.70s Fatal Error", appname);
    //MessageBox(hwnd, stuff, morestuff, MB_ICONERROR | MB_OK);
    sfree(stuff);

    if (conf_get_int(conf, CONF_close_on_exit) == FORCE_ON)
    PostQuitMessage(1);
    else {
    must_close_session = TRUE;
    }
}
Stephane
  • 6,432
  • 3
  • 26
  • 47
4

I would log out before going home in the evening, rather than the next morning.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
  • 1
    Thank you for the advice, but suggesting I leave work later than I already do doesn't really answer my question. :) FWIW, if I need to leave my computer on overnight or unattended, I do explicitly log out of my sessions, but I'm okay with a disconnect due to timeout (sleeping the computer) if I need to leave in a hurry. – jimp Apr 30 '13 at 16:41
  • I never suggested anything about staying late. If logging out would cause you to leave work late, perhaps you have way too many windows open. – Michael Hampton May 01 '13 at 00:11
  • Yes, I probably do. :-/ But I meant when I'm already late, there's often no time left to spare for closing browser tabs, emails, whatever. I'm really not meaning to be argumentative--just explaining it's not always practical (for me, at least) to avoid the situation although I'd like to. – jimp May 01 '13 at 02:42
  • You're creating a massive security concern for your sheer laziness. It should only take you 30 seconds to close out your term sessions nevermind the fact you should close them as you finish with them. – Jacob May 01 '13 at 02:48
  • @jimp - it takes about 3 seconds to right-click on your stack of putty windows and choose "Close All Windows" - http://i.stack.imgur.com/sq53O.png – Mark Henderson May 01 '13 at 02:48
  • @Jacob "massive security concern" -- What security concern could there be if I'm using the sessions up to the point I turn off the computer which then terminates all of them? I disagree that it's "lazy" to ask for a method to close them all at once. – jimp May 01 '13 at 13:12
  • @Henderson Thanks, but that doesn't work if any of them have the "fatal error" modal dialog. That's actually why I asked this question. Regardless, it is now closed as "off topic" -- I assume that to mean PuTTY usage does not fall under server administration with the way I asked it. Maybe Super User would have been a better SE to post under. – jimp May 01 '13 at 13:18
  • @jimp that's why you do that *before* suspending the laptop. Works also if you're already late as I highly doubt that those 3 seconds will make a difference. – Dennis Kaarsemaker May 10 '13 at 22:17
  • 4
    There are valid reasons for wanting this. In my case, I often have several sessions open and a vpn hiccup causes all of them to display the fatal error. I cannot close all the windows at once, I have to close each modal dialog first. (You can disable the warning before closing). – Wyrmwood Apr 30 '14 at 14:37
2

To avoid this issue, I am using a Linux server as a jump point. Here I run screen or tmux and all remote connections I am creating from screen or tmux. If the server has byobu package, I preffer to start screen or tmux from byobu.

Mircea Vutcovici
  • 17,619
  • 4
  • 56
  • 83
0

No, this is the server killing your connection because you were idle. You could prevent this by sending keepalives, perhaps once every hour (3600 seconds)

enter image description here

Sirch
  • 5,785
  • 4
  • 20
  • 36
  • 4
    Actually, if your Internet connection resets during the evening, it will cause the exact same situation.. – NickW Apr 30 '13 at 15:14
  • Thanks for the answer. I have keepalives enabled. The disconnect happens because I sometimes have to sleep my computer before disconnecting each session explicitly (often half a dozen or more with my work). I was just hoping for a way to disable the dialog that is intrusively telling me the information I already know. – jimp Apr 30 '13 at 16:44