Operating System - HP-UX
1833187 Members
2991 Online
110051 Solutions
New Discussion

finger command returns multiple people

 
SOLVED
Go to solution
Ben_40
Occasional Contributor

finger command returns multiple people

When I run the 'finger' command on some of my boxes, I sometimes get multiple responses. These responses aren't of the same person, but of different people. I've checked their password entry and I can't see anything untoward - uid are unique, shells are valid etc. Has anyone else experienced this or know what causes this? Thanks.
This space intentionally left blank.
1 REPLY 1
Steffi Jones_1
Esteemed Contributor
Solution

Re: finger command returns multiple people

I found a similiar case in the database:

Problem:

Running the command finger(1) with no options and a username as an argument returns extra, unexpected results:


$ finger b4901
Login name: b9401
In real life: test bod
Directory: /home/b9401 Shell: /usr/bin/sh
Never logged in.
No Plan.

Login name: bsmith
In real life: B Smith
Directory: /home/bsmith Shell: /bin/sh
Never logged in.
No Plan.


In this case the user bsmith was unexpected. bsmith's details appear in addition to the correct details.
Using the -m option returns only the desired user.


RESOLUTION

The extra entry is seen because of the way in which finger(1) performs its search.

With the -m option the search is confined to the user name. In the above example only b4901 would be matched.

However without this option the search also checks the real name field of /etc/passwd for the argument. As real names do not contain numbers, finger(1) strips these from the argument before performing a case-insensitive search.

Hence in the above example the search through the real name field is for b and not b4901. The search finds user bsmith, because their real name is set to 'B Smith' (the b is matched.)

There is not a single resolution for this issue, however the following points should be noted:

use finger -m to search using only the user name.
set real names appropriately. If the user's first name is not known then a solution would be to insert a period(.) instead of a space between initial and surname.


Hope that helps,

Steffi Jones