no terminal/ip address information displayed by "who am i"

  • Follow


Hi,

I guess it is a very simple question, however I am stuck.

I use "who am i" with 2 differnt logins on the same machine, and here
is what I get

lsfadmin@cbmccusbslretail1d:/export/home/lsfadmin> who am i
lsfadmin   pts/11       Mar  7 08:17    (10.4.186.74)


batchuid_dev@cbmccusbslretail1d:/apps/sas/users/batchuid_dev> who am i
batchuid_dev   /dev/pts/3   Mar  7 08:56


Why don't I get ip for my terminal for the second user id?

I will appereciate any help.

Thanks

Omer

0
Reply zubairom (4) 3/7/2006 1:58:12 PM

zubairom@gmail.com wrote:

> I guess it is a very simple question, however I am stuck.
> 
> I use "who am i" with 2 differnt logins on the same machine, and here
> is what I get
> 
> lsfadmin@cbmccusbslretail1d:/export/home/lsfadmin> who am i
> lsfadmin   pts/11       Mar  7 08:17    (10.4.186.74)
> 
> batchuid_dev@cbmccusbslretail1d:/apps/sas/users/batchuid_dev> who am i
> batchuid_dev   /dev/pts/3   Mar  7 08:56
> 
> Why don't I get ip for my terminal for the second user id?
> 
> I will appereciate any help.

That's what happens for an illegal name - batchuid_dev is longer than 8
characters. See "man useradd".

John Howells
0
Reply John 3/7/2006 2:33:17 PM


John Howells wrote:
> zubairom@gmail.com wrote:

>> Why don't I get ip for my terminal for the second user id?
>>
>> I will appereciate any help.
> 
> That's what happens for an illegal name - batchuid_dev is longer than 8
> characters. See "man useradd".

but utmpx.ut_user[] is defined in utmpx.h as
   char    ut_user[32];    /* user login name */

Perhaps it is just that the terminal session did not
record the utmpx.ut_host[] information.
0
Reply Oscar 3/7/2006 2:45:17 PM

Oscar del Rio wrote:
> 
> John Howells wrote:
> > zubairom@gmail.com wrote:
> 
> >> Why don't I get ip for my terminal for the second user id?
> >>
> >> I will appereciate any help.
> >
> > That's what happens for an illegal name - batchuid_dev is longer than 8
> > characters. See "man useradd".
> 
> but utmpx.ut_user[] is defined in utmpx.h as
>    char    ut_user[32];    /* user login name */
> 
> Perhaps it is just that the terminal session did not
> record the utmpx.ut_host[] information.

Just "who" will show the host information just fine, so that is not
correct. However, checking
http://cvs.opensolaris.org/source/xref/on/usr/src/cmd/who/who.c you will
find that at line 400 it uses the cuserid function, and that returns a
name using only the allowed limit of eight characters, so that at line
731 et seq it cannot find a match for the longer user name that is
stored in the utmpx file, and thus it drops through to line 776 and
displays the short form noted. QED. The perils of using invalid names.

John Howells
0
Reply John 3/8/2006 7:54:52 AM

Thanks for the help. Looks like it is the invalid name issue......

Is there any other way I can extract the login terminal information? At
this point it is not possible for me to change the name as it is being
used by many users

0
Reply zubairom 3/8/2006 8:12:57 PM

zubairom@gmail.com wrote:
> 
> Thanks for the help. Looks like it is the invalid name issue......
> 
> Is there any other way I can extract the login terminal information? At
> this point it is not possible for me to change the name as it is being
> used by many users

Better rename now and become legitimate, whatever the minor
inconveniences might be, but you could try something like:

  #! /bin/ksh

  tty=$( tty | cut -d/ -f3,4 )
  who | grep " $tty " | cut -d'(' -f2 | cut -d')' -f1

noting that you *CANNOT* merge the two lines into something like:

  who | grep " $( tty | cut -d/ -f3,4 ) " | cut ....

as then stdin is not the original tty.

John Howells
0
Reply John 3/9/2006 8:35:14 AM

Thanks John, this worked.

I will rename the account, eventualy, but I can not for at least next
few weeks, as the developers are in an intensive phase.....

Thanks a lot for your help

0
Reply zubairom 3/9/2006 3:24:59 PM

6 Replies
302 Views

(page loaded in 0.962 seconds)

Similiar Articles:













7/26/2012 7:13:03 AM


Reply: