Operating System - HP-UX
1833463 Members
2564 Online
110052 Solutions
New Discussion

Re: Is there an auto-logout setting for TELNET

 
SOLVED
Go to solution
Gary Yu
Super Advisor

Is there an auto-logout setting for TELNET

As we know, we can set a time-out or auto-logout for a unattended terminal. I am interested to know if there's a similar setting for telnet service.

the reason for that is: sometime, when I leave a telnet session idle for some time, then it would be logged off by the remote server automatically, I don't know the reason.

Any comment on the breaking of telnet connection is appreciate.
8 REPLIES 8
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Is there an auto-logout setting for TELNET

Hi,

You simply need to set the the TMOUT variable in the user .profile; the shell will then exit and thus log off a telnet user.

in the user's .profile
export TMOUT=30

to logoff after 30 minutes of inactivity
If it ain't broke, I can fix that.
James R. Ferguson
Acclaimed Contributor

Re: Is there an auto-logout setting for TELNET

Hi:

Yes, if the shell variable TMOUT is set greater than zero (0). Then, this will cause the shell to terminate if a command is not entered within TMOUT number of seconds after issuing the PS1 prompt.

...JRF...
Gary Yu
Super Advisor

Re: Is there an auto-logout setting for TELNET

Thanks guys for your instant reply!

So, in terms of TMOUT, it's the same effect on telnet as with local terminals?
A. Clay Stephenson
Acclaimed Contributor

Re: Is there an auto-logout setting for TELNET

Hi Gary:

The real answer is that the shell is the same and when it exits the underlying daemon (in this case telnetd) responds.

If it ain't broke, I can fix that.
Gary Yu
Super Advisor

Re: Is there an auto-logout setting for TELNET

Thanks Clay, I am clear now :)
Bill Hassell
Honored Contributor

Re: Is there an auto-logout setting for TELNET

It's important to note that telnet does not have a timeout value, it's the shell you are using. For POSIX and ksh, the value is TMOUT, while for csh, it is autologout and the units of measure are different (seconds versus minutes). Other shells (bash, tcsh and so on) may have similar env values. A useful technique is to set the TMOUT and autologout values with the modifier: readonly as in:

readonly TMOUT=3600

NOTE: not even root can change a readonly env variable in the shell. User timeouts should probably be longer than root (root should have a short, 15-60 minutes).

But most important, the shell does the counting! So if the user starts a subprocess, for example: vi then the counting stops because the shell is not running. When vi terminates, the shell starts counting all over again.


Bill Hassell, sysadmin
Brian M. Fisher
Honored Contributor

Re: Is there an auto-logout setting for TELNET

Another "trick" I have seen to avoid the TMOUT setting is to type the backslash character on a blank line. This is a line continuation character that tells the shell there is more information to come.

Brian
<*(((>< er
Perception IS Reality
sreejith_4
Frequent Advisor

Re: Is there an auto-logout setting for TELNET

Hi,

Anyone can please tell me where the autologout variable set. I couldn't find it in .profile.

Thanks
Sreejith M