Solved

Why does the last command does not display hostname for some logins?

Posted on 2008-06-17
5
229 Views
Last Modified: 2013-12-16
The last command on one of our development systems does not display the hostname for some of our logins, and there is not a corresponding entry for a login in /var/log/messages.  What could cause this?
alex     pts/1        chico.pao.efront Tue Jun 10 14:47 - 17:39  (02:51)

alex     pts/1        chico.pao.efront Tue Jun 10 11:43 - 11:44  (00:00)

release  pts/4                         Tue Jun 10 05:40 - 05:46  (00:05)

release  pts/2                         Tue Jun 10 05:40 - 05:46  (00:05)

release  pts/0                         Tue Jun 10 05:40 - 05:46  (00:05)

release  pts/12                        Tue Jun 10 05:40 - 05:46  (00:05)

release  pts/3                         Tue Jun 10 05:40 - 05:46  (00:05)

release  pts/10                        Tue Jun 10 05:40 - 05:46  (00:05)

release  pts/11                        Tue Jun 10 05:40 - 05:46  (00:05)

release  pts/7                         Tue Jun 10 05:40 - 05:46  (00:05)

Open in new window

0
Comment
Question by:mikronixx
  • 2
  • 2
5 Comments
 
LVL 10

Assisted Solution

by:PeturIngiEgilsson
PeturIngiEgilsson earned 50 total points
ID: 21808628
I looked thro my 'last' on openSuSE 10.3

If i open up a new 'xterm' from within Gnome (i didn't try any other window manager) .. then a new enrty is added to wtmp (the file used by 'last ) without the hostname.

petur@oxygen:~> last
petur    pts/2        :0.0             Wed Jun 18 00:07   still logged in   # gnome-console started from within X
petur    pts/3                         Wed Jun 18 00:06 - 00:06  (00:00)     # xterm started from within X
petur    pts/3                         Wed Jun 18 00:04 - 00:05  (00:00)     # xterm started from within X
petur    pts/3        :0.0             Wed Jun 18 00:04 - 00:04  (00:00)   # gnome-console started from within X

Even more interesting is.. if i use the -i switch after last i'll get strange results:

petur@oxygen:~> last -i
petur    pts/2        0.0.0.0          Wed Jun 18 00:07   still logged in  
petur    pts/3        230.73.9.0       Wed Jun 18 00:06 - 00:06  (00:00)    # I've never seen that IP before..
petur    pts/3        235.21.2.0       Wed Jun 18 00:04 - 00:05  (00:00)    # Neither have i seen this one
petur    pts/3        0.0.0.0          Wed Jun 18 00:04 - 00:04  (00:00)    

It turns out those weird IP's are Class D ip addresses, they are reserved for multicast groups ( Packet or message sent across a network by a single host to multiple clients or devices. )

It could be that 'last' simply ignores ip's from that range and displays the hostname as a blank field.

try `last -i` .. if the login source address is in the range of 224.0.0.0 to 239.255.255.255 you can (i think?) assume it's from your local computer.

0
 

Author Comment

by:mikronixx
ID: 21808852
interesting:  i get the following with last -i:

release  pts/5        0.0.0.0          Tue Jun 17 09:58 - 10:13  (00:15)
release  pts/1        0.0.0.0          Tue Jun 17 09:58 - 10:13  (00:15)

i do not get multicast addresses.

no user should be able to login from the console.  This box is in a locked server room
0
 
LVL 10

Expert Comment

by:PeturIngiEgilsson
ID: 21809491
What is the purpose of the "release" user?
0
 
LVL 40

Accepted Solution

by:
omarfarid earned 75 total points
ID: 21809659
I think hostname / ip address will be displayed if the user is connecting or logging in from remote system. For login from the same system (e.g. console) the hostname is not displayed and it may show the ip 0.0.0.0 which is the local host.
0
 

Author Closing Comment

by:mikronixx
ID: 31468189
I am guessing what i am seeing is a fork from a script.  these answers work for me
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will explain how to make squid prevent malwares in five easy steps: Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-…
I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now