Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Sep 2001 12:54:25 -0600 (MDT)
From:      Mike Brown <mike@skew.org>
To:        questions@freebsd.org
Subject:   Re: 'w -n' returning hostnames -- SOLVED
Message-ID:  <200109051854.f85IsPx60561@skew.org>
In-Reply-To: <20010905174155.U96906@sunbay.com> "from Ruslan Ermilov at Sep 5, 2001 05:41:55 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
Ruslan Ermilov wrote:
> Make sure the w(1) in question is /usr/bin/w.

It is. But you got me to thinking about it some more, and for
the sake of the archives, I am posting a better diagnosis.

w(1) is just interpreting what is in /var/run/utmp. Upon
examining this file, I see that it contains the truncated 
hostname in some cases, not the IP address.

utmp is written to by login(1) if you use telnet or if you use
ssh with "UseLogin yes" in sshd_config. Otherwise utmp is
updated by sshd.

I just realized that I had "UseLogin no" in the config, so sshd
is doing the utmp maintenance on this system, whereas on the
other system with the working 'w -n', I have "UseLogin yes" and
it is login(1) doing the maintenance.

It looks like the solution is to invoke sshd with the "-u0"
option, or to use UseLogin yes. I'm going with the latter
because changes to /etc/login.conf (.db) aren't picked up
if you don't use login(1).

   - Mike
____________________________________________________________________________
  mike j. brown, fourthought.com  |  xml/xslt: http://skew.org/xml/
  denver/boulder, colorado, usa   |  personal: http://hyperreal.org/~mike/



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200109051854.f85IsPx60561>