15

I'm working remotely on a new CentOS 7 VM. I have screen running with several open sessions. I'm finding that if I leave one of the sessions idle for awhile, then try to come back to it, it's gone. Nothing special going on in the sessions - ssh connections to other systems, mysqlclient, top, etc. - those all stay up. But if I just leave a session sitting at the bash shell prompt, it disappears - I just watched one and it took about 10-11 minutes.

I've never had that happen before. Any idea what's going on?

New information. It's probably not screen. I opened a new ssh session to this system and left it idle. And it closed on me as well. But this time I got a message:

timed out waiting for input: auto-logout

Off to google... probably some goofy shell setting?

4
  • When you say it "disappeared", was it that the screen session ended, or was it that a GUI window containing the screen session closed on you leaving the session still running but no longer connected and visible? Commented Jan 27, 2017 at 21:51
  • 1
    "disappeared" as in if I flip through the screen sessions (ctrl-a n, ctrl-a p) the session is no longer there. Screen is still running. There were 4 sessions, as counted with ctrl-a ". Come back 10 minutes later and the 3 sessions with something going on are still there, and the idle bash session is just gone. Commented Jan 27, 2017 at 21:57
  • 3
    Is the bash variable TMOUT set to a positive integer? That's the number of seconds before an idle shell will close. Commented Jan 27, 2017 at 21:59
  • That's it exactly - our friendly neighborhood sysadmins saw fit to set it in /etc/profile.d/os-security.sh It's all better now - thanks :) Commented Jan 27, 2017 at 22:09

2 Answers 2

15

A bash shell can be configured to exit after a certain amount of idle time. This value is defined with the TMOUT variable.

For example, TMOUT=300 will cause the shell to exit after 5 minutes (300 seconds) of inactivity.

3

In my case, it was configured in /etc/profile.d/tmout.sh file and it was set as readonly and I could not modify it later on. I added the below line in my /etc/bash.bashrc file so it worked every time bash is initialized.

sed -i 's/TMOUT=900/TMOUT=0/g' /etc/profile.d/tmout.sh
2
  • That edits the file each time the script is executed. Is that really what you intended? Commented Nov 24, 2021 at 14:26
  • My scenario is mostly a test environment and it is acceptable. Good that you highlighted so that any cautious user will be aware of it. Commented Nov 25, 2021 at 17:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .