[SunHELP] setting shell timeouts

Nicholas Dronen sunhelp at sunhelp.org
Thu Mar 22 10:48:02 CST 2001


On Thu, Mar 22, 2001 at 06:13:01AM -0800, J P wrote:
> Hey all,
> how do you set a shell timeout for every user on a
> system, or for any one user either?

With the Korn shell, just make TMOUT a readonly
environment variable.

$ readonly TMOUT=5; export TMOUT
$   
shell will timeout in 60 seconds due to inactivity

With the C shell, who knows?  I suggest simply
not using it.  Tcsh might have something that 
works, however.

To make this global, put it in /etc/profile.
It's a bit tougher to make this local to a user
without allowing them to change it.  You
can set the environment variable in .profile
or .kshrc, but since the user probably needs
write permission to his or her own home directory,
you can't prevent him or her from editing
the file and simply logging in again.

If you want the timeout to apply only to a
certain set of users, you can put shell
script code in /etc/profile to check the
user's uid (or gid) to determine whether
to set the variable when he or she logs
in.

Regards,

Nicholas Dronen



More information about the SunHELP mailing list