-l This option lists those lines on which the system is
waiting for someone to login. The name field is LOGIN
in such cases. Other fields are the same as for user
entries except that the state field does not exist.
ifincham,
If I have interpreted you correctly....if a remote user is connected to my box..the 'who -l' command tries to resolve the IP of the remote user is connected from ..right?
regards
CM
PS:
no this is not a homework assignment...this is a genuine enquiry from someone trying to learn SysAdmin. "Brahmaiva satyam"
-Adi Shankara (788-820 AD)
Yes, it actually tries to resolve all the 'hostnames' found using the standard resolver functions - could be /etc/hosts, dns, etc.
If you really want to know look at the source code (who.c in ftp://ftp.gnu.org/pub/gnu/sh-utils/sh-utils-2.0.tar.gz) .
That calls canon-host.c which in turn uses the system calls gethostbyname() and then gethostbyaddr() - i.e. :
if (addr && strcmp (he->h_name, addr) == 0)
{
/* gethostbyname has returned a string representation of the IP
address, for example, "127.0.0.1". So now, look up the host
name via the address. Although it may seem reasonable to look
up the host name via the address, we must not pass `he->h_addr'
directly to gethostbyaddr because on some systems he->h_addr
is located in a static library buffer that is reused in the
gethostbyaddr call. Make a copy and use that instead. */
char *h_addr_copy = strdup (he->h_addr);
if (h_addr_copy == NULL)
he = NULL;
else
{
he = gethostbyaddr (h_addr_copy, he->h_length, he->h_addrtype);
free (h_addr_copy);
}
}
Also, interesting that on the Digital Unix box i'm using at the moment the -l parameter is the same as KenCunningham posted - i.e. this is probably unique to the gnu/linux version of 'who'.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.