Operating System - HP-UX
1837948 Members
1847 Online
110124 Solutions
New Discussion

Re: Disconnect user idles

 

Disconnect user idles

I want to disconnect the users, who have without using the meeting of UNIX, for space of 30 minutes.
6 REPLIES 6
John Poff
Honored Contributor

Re: Disconnect user idles

Hi,

One way is to set the TMOUT environment variable. If they have no activity after the number of seconds specified in TMOUT they will be disconnected. Here is a snippet from the sh-posix man page:


TMOUT If set to a value greater than zero, the shell will
terminate if a command is not entered within the
prescribed number of seconds after issuing the PS1
prompt. (Note that the shell can be compiled with a
maximum bound for this value which cannot be exceeded.)


JP
Jeff Schussele
Honored Contributor

Re: Disconnect user idles

Hi Magdalena,

There's several ways to do this. The easiest way & the way I prefer is to put
TMOUT=1800
in the users .profile
This will terminate their shell after 30 minutes of inactivity.

If you put this in the /etc/profile file it will apply to ALL users.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Sridhar Bhaskarla
Honored Contributor

Re: Disconnect user idles

Hi,

Use TMOUT for non c-shells and autologout for c-shell.

Edit /etc/profile and keep an entry at the end like

TMOUT=1800
export readonly TMOUT

this will time out the shells after 30 mins of idle time.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Jeff Schussele
Honored Contributor

Re: Disconnect user idles

Oops...forgot to add that you'll also need
export TMOUT

Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Deshpande Prashant
Honored Contributor

Re: Disconnect user idles

Hi
For kshell users TMOUT parameter will do the same.
In /etc/profile define
TMOUT=1800
readonly TMOUT

This way all shell prompts will get terminated after 30 min. of inactivity.

Thanks.
Prashant.
Take it as it comes.
Jordan Bean
Honored Contributor

Re: Disconnect user idles


Naturally you'll want to export the TMOUT variable from each users' .profile or selectively from the /etc/profile. This takes care of those idle and jobless login shells.

However, this problem extends beyond the login shell. We also need to address how to deal with users who login to an application and walk away. If the application itself doesn't timeout, how do we gracefully terminate it and the login. Now the problem isn't so easy. The solutions depend on how well behaved are the applications and login profiles.