Hi. On Wed, Sep 09, 2015 at 01:18:34PM +0100, Michael Grant wrote: > > On Wed, Sep 9, 2015 at 12:24 PM, Reco <recovery...@gmail.com> wrote: > > Hi. > > On Wed, Sep 09, 2015 at 10:46:53AM +0100, Michael Grant wrote: > > (I of course edited my own host's ip address here for 10.20.30.40) > > > > But yes, getent resolves my host ip to a name. who/w/finger/last all > still do not resolve the host. > > Ok, then we'll have to do it the hard way. > > Please post the output of 'strace w'. > > > $ getent hosts 10.20.30.40 > 10.20.30.40 host10-20-30-40.example.com > $ w > 05:46:33 up 3 days, 22:18, 4 users, load average: 0.04, 0.07, 0.06 > USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT > mgrant pts/1 10.20.30.40:S. Sat07 22:05m 0.09s 0.09s /bin/bash > mgrant pts/2 10.20.30.40:S. Sat07 22:05m 0.27s 0.05s /bin/bash > mgrant pts/3 10.20.30.40:S. Sat07 0.00s 6.00s 0.07s /bin/bash > mgrant pts/4 10.20.30.40:S. Sat07 3days 0.57s 0.57s emacs > $ strace w > execve("/usr/bin/w", ["w"], [/* 25 vars */]) = 0 <abridged> > exit_group(0) = ? > +++ exited with 0 +++
Ok. This strace output clearly shows that 'w' does not even trying to resolve IPs to hostnames. Hence, even more hard way should be tried - looking at the source. 'w' you're using should belong to 'procps' package, source of which is here: git://git.debian.org/collab-maint/procps.git The source file for 'w' is, unsurprisingly, 'w.c', which has this check: if (from) print_from(u, ip_addresses, fromlen); So, basically they decide to print hostnames only of 'from' variable is set to 0, which is set in 'main' function to '1' initially: /* switches (defaults) */ int header = 1; int longform = 1; int from = 1; For reasons unknown, 'from' can be set to 0 initially if one is using W_SHOWFROM compilation flag. This flag is set for squeeze's procps, but unset starting with wheezy (as far as I can tell): #ifndef W_SHOWFROM from = 0; #endif '-f' flag for 'w', which, according to the manpage, should enable IP->hostname resolving, merely inverts 'from' flag: while ((ch = getopt_long(argc, argv, "husfoVi", longopts, NULL)) != -1) switch (ch) { case 'h': header = 0; break; case 'l': longform = 1; break; case 's': longform = 0; break; case 'f': from = !from; break; And, as the cherry on a pie, there's this commit e14b7c261042020b19f73a032be53d7728b6c29f, dated 6 Jan 2012, aptly named "Imported Upstream version 3.3.2", which changed default 'from' value from '0' to '1'. So, long story short, last version of 'w' which printed hostnames by default should be squeeze's one, and even then they used compilation flag to make it do so. Reco