Operating System - HP-UX
1832751 Members
2705 Online
110045 Solutions
New Discussion

who -u shows incomplete ip address

 
Masaki Birchmier
Frequent Advisor

who -u shows incomplete ip address

I have 2 boxes running 11.00, on the first box "who -u" returns the complete ip address,
###.###.###.###

on the other box it returns something like
###.###.###:0.0

Anyone have any ideas why?
Both "who" are Revision 80.2
8 REPLIES 8
Sijesh
Advisor

Re: who -u shows incomplete ip address

who -u returns ip address only when its not able to resolve the name.

your second system may be resoving the name as "###.###.###.0.0"

Sijesh


Sanjay Kumar Suri
Honored Contributor

Re: who -u shows incomplete ip address

I have following observation.

When simple telnet to a system is used, who -u shows:

###.###.###.###

whereas whenever XWindows is used who -u displays

###.###.###:0.0

sks
A rigid mind is very sure, but often wrong. A flexible mind is generally unsure, but often right.
T G Manikandan
Honored Contributor

Re: who -u shows incomplete ip address

You are running xwindows on that machine.
Sanjiv Sharma_1
Honored Contributor

Re: who -u shows incomplete ip address

Hi Masaki,

###.###.###.### seems to be for the telnet connection and ###.###.###:0.0 seems to be from the xwindows connection.

hth.


Everything is possible
Sanjiv Sharma_1
Honored Contributor

Re: who -u shows incomplete ip address

Hi Masaki,

###.###.###.### seems to be for the telnet connection and ###.###.###:0.0 seems to be for the xwindows connection.

hth.


Everything is possible
Dietmar Konermann
Honored Contributor

Re: who -u shows incomplete ip address

The who command reads its information by default from /etc/utmp. This file has an ut_addr (IP address) and an ut_host (host name) field. The who command tries to return the most reasonable information by using 1st the ut_host field and only if needed the ut_addr field (reverse looked up if possible).

from man page of who(1):

-R
Displays the user's host name. If the user is
logged in on a tty, who displays the string
returned from gethostname() (see gethostname(2)).
If the user is not logged in on a tty and the host
name stored in the /etc/utmp or named file has not
been truncated when stored (meaning that the
entire host name was stored with no loss of
information), it is displayed as it was stored.
Otherwise, the gethostbyaddr() function is called
with the internet address of the host (see
gethostent(3N)). The host name returned by
gethostbyaddr() is displayed unless it returns an
error, in which case the truncated host name is
displayed.

So essentially the tools logging to utmp are responsible. Usually these are login(1), telnetd(1M) and friends. For X11 sessions the terminal emulators enter the game... hpterm, xterm, etc.

So, the answer to your question depends on what exactly you are doing when you logon to the box via X11.

Best regards...
Dietmar.

"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
Masaki Birchmier
Frequent Advisor

Re: who -u shows incomplete ip address

I use Exceed's "Xstart" to open xterm windows to various hosts.

Both connections are using "xterm". One connections shows the complete ip address while the other drops the last segment and inserts 0.0

What I'm REALLY trying to do is to automate
the "export DISPLAY=....." command, with
this in my .profile (for when I su, or open connections from a different host)

export DISPLAY="$(/usr/bin/who -muR|awk '{print $NF}'):0.0"

but it only works on my system that returns the complete IP address with "who -u"
Dietmar Konermann
Honored Contributor

Re: who -u shows incomplete ip address

Check the output of this command:

# /usr/sbin/acct/fwtmp < /etc/utmp

It dumps utmp in a readable format. The right two columns contain ut_addr and ut_host. The ut_host field should contain a hostname.

Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)