Prob with inetutils telnetd not writing to /var/run/utmp

Corinna Vinschen
Fri Jan 19 01:42:00 GMT 2001

On Thu, Jan 18, 2001 at 01:49:01PM -0700, Kevin Wright wrote:
> Hello,
> I recently upgraded to Cygwin 1.1.7 (from 1.1.4) and am happy that 
> the shellutils who utility now reports the current users logged in. 
> It might have been working for a long time but I personally just got 
> it working now. 
> Here's the current output of who:
> $ who
> kwright  tty0     Jan 17 19:00 (holstein-mobile.ASPECTDV.COM)
> kwright  tty1     Jan 17 17:53 (holstein-mobile.ASPECTDV.COM)
> kwright  tty2     Jan 17 18:31 (holstein-mobile.ASPECTDV.COM)
> According to the output from strace, who derives it's info from
> /var/run/utmp. However, if someone logs in remotely via telnet,
> /var/log/wtmp gets updated. To find out who is logged in remotely,
> I have to pass /var/log/wtmp as a parameter to who, thus:
> $ who /var/log/wtmp
> [output deleted]
> kwright  tty2     Jan 17 16:54 (holstein-kw)
> kwright  tty3     Jan 17 17:22 (holstein-mobile.ASPECTDV.COM)
> kwright  tty1     Jan 17 17:53 (holstein-mobile.ASPECTDV.COM)
> kwright  tty2     Jan 17 18:31 (holstein-mobile.ASPECTDV.COM)
> kwright  tty0     Jan 17 19:00 (holstein-mobile.ASPECTDV.COM)
> This not only gives you the list of current users but also a
> list of past logins, which means I can't tell if the who
> is still logged in. (other than checking the current number 
> of in.telnetd processes)
> My question is, is this expected behavior or should telnetd also
> be writing to /var/run/utmp? I looked at the source and found 
> references to utmp but they are ifdeffed and I couldn't figure
> out whether it is supposed to be used or not. 

I just tried to remotely logon to my Cygwin box using ssh, telnet
and rlogin. As far as I can tell, everything is ok. Login with all
three methods leave their marks as they should. I can't see any
flaw that a login via telnet doesn't show up in the standard
`who' output.

Just to be sure, I had another look into the man page of utmp/wtmp
on my Linux box. Excerpt:

       The utmp file allows one to discover information about who
       is currently using the system.  There may  be  more  users
       currently  using  the system, because not all programs use
       utmp logging.

Especially the latest sentence is of interest. While telnet is
doing the right thing AFAICS, I think the above is good to know.

       The wtmp file records all logins and logouts.  Its  format
       is  exactly  like  utmp except that a null user name indi­
       cates a logout on the associated  terminal.

So wtmp is containing the right entries either as your above
output states.

       [...] wtmp  is  maintained  by
       login(1), and init(1) and some versions of getty(1).  Nei­
       ther of these programs creates  the  file,  so  if  it  is
       removed record-keeping is turned off.

That's just FYI. Keep track of the size of wtmp when you are using
it since it always grows unless you don't shrink it to size 0
from time to time.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                      
Red Hat, Inc.

Want to unsubscribe from this list?
Check out:

More information about the Cygwin mailing list