Operating System - HP-UX
1820475 Members
2860 Online
109624 Solutions
New Discussion юеВ

TMOUT - my understanding (and its effectiveness)

 
SOLVED
Go to solution
Scott Lindstrom_2
Regular Advisor

TMOUT - my understanding (and its effectiveness)

I have been reading all the posts I can about TMOUT and wanted to confirm my understanding of all the posts. Please let me know if I understand this correctly.

- TMOUT will only time you out after xxx seconds of sitting at a shell prompt.
- It will not timeout if you are sitting at a menu.
- It will not time out a process waiting for some other reason - that is, your process is awaiting something other than a command yet you are not accumulating CPU time (for example, background processes).

It does not seem that TMOUT affects a user who is within a program - whether that be a menu, vi, etc, and yet is truly idle. If you need this to happen, you need to write your own script and monitor for idle sessions and then kill them.

(I guess the last point is what make me wonder how effective TMOUT really is. It seems all I really need to do to defeat TMOUT is enter vi at a command line).

We do set TMOUT as readonly in /etc/profile, so at least we know it can't be defeated in a users profile by specifying a greater value.

Scott
4 REPLIES 4
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: TMOUT - my understanding (and its effectiveness)

You have it. By the way, determining if a process is truly idle and safe to signal (kill) is a far from trivial exercise. It is easy to determine if the controlling terminal has not been modified within a period of time but that is not the same as knowing whether or not it is safe to kill a particular process.
If it ain't broke, I can fix that.
Arunvijai_4
Honored Contributor

Re: TMOUT - my understanding (and its effectiveness)

Exactly right, # man ksh says,

If set to a value greater than zero, the shell
terminates if a command is not entered within the prescribed number of seconds after issuing the PS1 prompt.

If this parameter is set to a value greater than zero and you do not enter another command or Return within that number of seconds, the shell terminates.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Gopi Sekar
Honored Contributor

Re: TMOUT - my understanding (and its effectiveness)


You are exactly correct. TMOUT variable is something what shell defines to give certain level security to administrators. All that it can do is controlling idle time of the shell, but if the user enters in to some other program (eg: vi) then the tty control (stdin, stdout, stderr) is taken care by the new application and shell can not do anything about it.

so if you really want to control the idle time then you have no other choice other than implementing TMOUT in every other application or write application which can monitor stdin/stdout of each tty and kill the process if these handles are not modified within specified time.

Hope this helps,
Gopi
Never Never Never Giveup
Muthukumar_5
Honored Contributor

Re: TMOUT - my understanding (and its effectiveness)

TMOUT will work based on the terminal activity. It is calculating based on who -Hu execution for IDLE tab. If something is working with vi etc then it will dot (.) that is it is active.

A more good thread on TMOUT:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=961132

hth.
Easy to suggest when don't know about the problem!