?
Solved

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

Posted on 2008-06-17
5
Medium Priority
?
234 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 10

Assisted Solution

by:Pétur Ingi Egilsson
Pétur Ingi Egilsson earned 200 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:Pétur Ingi Egilsson
ID: 21809491
What is the purpose of the "release" user?
0
 
LVL 40

Accepted Solution

by:
omarfarid earned 300 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

Application Discovery Service in AWS

In the era of the cloud, customers migrating away from their existing on-premise infrastructure. This requires lots of planning, strategies, and effort to identify their existing resources and determine how best to migrate.  Datacenter migrations happen in four phases -

Question has a verified solution.

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

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses
Course of the Month9 days, 3 hours left to enroll

765 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