[comp.unix.questions] Preventing Idle in telnet

huebner@aerospace.aero.org (Robert E. Huebner) (09/12/90)

Looking for advice on how to solve the following problem in UNIX:

I need to find a way to alter telnet so that it will automatically
send characters periodically if the user is idle.  The specific case
is one where I am using telnet on a Sun to connect to a remote Multics.
The Multics has a "feature" which automatically logs me out if idle
time exceeds 30 minutes, even if processes are running.  Is there some
way to have telnet type a ^G sequence or something whenever idle time
exceeds 25 minutes?  Or is there a more elegant solution to this
problem.  I have no Multics experience, so I'd like to make the fix from
the Sun/telnet end of things.

Thank you for your time,
+----
Robert E. Huebner	huebner@aerospace.aero.org	Sometimes you win,
			The Aerospace Corporation	Sometimes you lose,
			Computer Security Office	Sometime it rains.
+----

pemurray@miavx1.acs.muohio.edu (Peter Murray) (09/24/90)

In article <85234@aerospace.AERO.ORG>, huebner@aerospace.aero.org (Robert E. Huebner) writes:
> Looking for advice on how to solve the following problem in UNIX:
> 
> I need to find a way to alter telnet so that it will automatically
> send characters periodically if the user is idle.  The specific case
> is one where I am using telnet on a Sun to connect to a remote Multics.
> The Multics has a "feature" which automatically logs me out if idle
> time exceeds 30 minutes, even if processes are running.  Is there some
> way to have telnet type a ^G sequence or something whenever idle time
> exceeds 25 minutes?  Or is there a more elegant solution to this
> problem.  I have no Multics experience, so I'd like to make the fix from
> the Sun/telnet end of things.
> 
> Thank you for your time,

What you can do is write a small C program to send a space and a backspace
every 25 minutes.  Something like:

main()
{
	while (1)
	{
		sleep(1500);
		printf("\033[OC\033[OD");
		fflush(stdout);
	}
}

And then start it in the background.

Peter
-- 
Peter Murray            Neat UNIX Stunts #3:             pemurray@miavx1.bitnet
176 Thompson Hall        csh> sleep with me       pmurray@apsvax.aps.muohio.edu
Oxford, OH 45056                       NeXT Mail:  pmurray@next4.acs.muohio.edu

mitch@hq.af.mil (Mitch Wright) (09/25/90)

/*
 * In article <85234@aerospace.AERO.ORG>, 
 * huebner@aerospace.aero.org (Robert E. Huebner) writes:
 *
 */

Robert> Looking for advice on how to solve the following problem in UNIX:
Robert> I need to find a way to alter telnet so that it will automatically
Robert> send characters periodically if the user is idle.  The specific case
Robert> [ ... ]

/* 
 * On 24 Sep 90 15:54:50 GMT, 
 * in article <2399.26fde5fb@miavx1.acs.muohio.edu> 
 * pemurray@miavx1.acs.muohio.edu (Peter Murray) writes:
 *
 */

Peter> What you can do is write a small C program to send a space and a
Peter> backspace every 25 minutes.  Something like:

Peter> main()
Peter> [...]
Peter> 		printf("\033[OC\033[OD");
Peter> [...]

This shouldn't really do the job.  When you printf to your screen, it
does not simulate the user actually hitting keys; thus, the idle time will
continue to accumulate.  There is a request to ioctl that you can make to
simulate a key being typed -- TIOCSTI.  It works for me...

   ..mitch

   mitch@hq.af.mil (Mitch Wright) | The Pentagon, 1B1046 | (202) 695-0262

   The two most common things in the universe are hydrogen and stupidity,
   but not necessarily in that order. 

ken@CSUFRES.CSUFRESNO.EDU (Dorothy (Dot)) (09/25/90)

In article <85234@aerospace.AERO.ORG>, huebner@aerospace.aero.org (Robert E. Hue
bner) writes:
> Looking for advice on how to solve the following problem in UNIX:
>
> I need to find a way to alter telnet so that it will automatically
> send characters periodically if the user is idle.  The specific case
> is one where I am using telnet on a Sun to connect to a remote Multics.
> The Multics has a "feature" which automatically logs me out if idle
> time exceeds 30 minutes, even if processes are running.  Is there some
> way to have telnet type a ^G sequence or something whenever idle time
> exceeds 25 minutes?  Or is there a more elegant solution to this

	I had this problem  downloading huge K files.
I explained my problem to the SysAd and he added my account
to a list of users who need more than 30 minutes idle time.  I
have had no trouble since.  I have downloaded Kermit files that
take well over an hour or two with no blankety-blank automatic
logouts.  Of course, our SysAd is one hell of a nice guy.  
                                                    
                                                          Dorothy
ken@csufres.csufresno.edu

aeba-im-o-e2@berlin-emh1.army.mil ( Kendrick Gibson) (09/25/90)

Should an idle keyboard be reason to automatically log a
user out?

Is there a better way for the Sys Ad to determine whether a user
is really idle?  

Ken Gibson			aeba-im-o-e2@berlin-emh1.army.mil
Asst. SA Berlin E-Mail Host
I'd rather be telecommuting.

dik@cwi.nl (Dik T. Winter) (09/26/90)

In article <24593@adm.BRL.MIL> aeba-im-o-e2@berlin-emh1.army.mil ( Kendrick Gibson) writes:
 > Should an idle keyboard be reason to automatically log a
 > user out?
 > 
 > Is there a better way for the Sys Ad to determine whether a user
 > is really idle?  
 > 
This is all based on a few assumptions that are all wrong:

1.  If there is no input during some time the user is idle.
What about long compiles, long downloads?
2.  If there is coninuous input the user is not idle.
Case in fact, some time ago when a logged in remotely to a system the phone
line generated enough noise to let the system not drop the connection while
I was not even at home.

No, there really is no way to determine whether a user is idle or not.
Checking input fails (see above), checking output fails also (in case two
above the system generated quite a lot of error messages on the noise).
Also, checking output can easily be spoofed.

Back to the original question.  I had the same problem with a system that
would disconnect me after only 5 minutes of 'idle' time.  I patched up a
private version of telnet.  The sources for telnet are available by
anonymous ftp from uunet.uu.net (bsd-sources/network/telnet.tar.Z).
It is easy to modify the sources to output every few minutes a single
character (I did use a null byte).  (see alarm(3)).  If you do not have
a BSD system it might be more difficult, because all networking might
be done differently.  If you have any problems feel free to ask.
--
dik t. winter, cwi, amsterdam, nederland
dik@cwi.nl

chris@mimsy.umd.edu (Chris Torek) (09/28/90)

In article <2239@charon.cwi.nl> dik@cwi.nl (Dik T. Winter) writes:
>This is all based on a few assumptions that are all wrong ....

I agree.  I have been forced to implement `idle timeouts' occasionally,
and I have always made them easy to defeat, because they are too often
wrong.  Even if you make them difficult to defeat, people will eventually
defeat them---and then those `legitimately idle' will be doing extra
work and those `illegitimately idle' will not be caught anyway.

(What we have now on the CS department machines is an `idle warning'
mail-generator that scans dialups and sends mail only.  If someone is
perpetually idle we use administrative action to fix it.)
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 405 2750)
Domain:	chris@cs.umd.edu	Path:	uunet!mimsy!chris

gwyn@smoke.BRL.MIL (Doug Gwyn) (09/30/90)

In article <24593@adm.BRL.MIL> aeba-im-o-e2@berlin-emh1.army.mil ( Kendrick Gibson) writes:
>Should an idle keyboard be reason to automatically log a user out?

Definitely not!  Just because a person is not interacting at the moment
does NOT mean that he does not need the connection maintained.  There
are dozens of possible scenarios; I'll leave them as an exercise.

>Is there a better way for the Sys Ad to determine whether a user
>is really idle?  

Yes -- go take a look at the user, and if he has stopped breathing,
you may safely assume he's idle.

Seriously, you seem to imply that there is some sort of "problem"
that needs to be solved.  Just what IS the problem?