[HPADM] Summary: who am i -R oddness

From: Justin Willoughby (jwilloug@mhc.net)
Date: Wed Jul 02 2003 - 09:37:39 EDT


There were a number of responses to this question. One or two indicated they had seen the same problem using this command and that they were going to be following up with HP on it.

Once alternate suggestion from Shaji was to use the following:

>> TERMINAL=$(tty | sed 's!/dev/!!')
>> HOST=$(who -u | grep "$TERMINAL " | awk '{print $8}')

I might give this a try, it does take a little longer to run then the 'who am i -R' bit I guess if it works correctly then it's worth it.

Another alternate suggestion was from Lou:

>> export userip=`whoami`
>> finger $userip |grep pts | awk '{print $9}'

However if the user is logged in twice this could be a problem but in my case this should not happen.

Bill Hassell has a simpler way of getting the information, although I am guess as it's using who it might still return an incorrect now and then.

>> USERIP=$(who -muR | awk '{print $NF}')

I would like to take everyone who replied to my question: Chris W., John A., Bill H., Lou, Corrne B., Angelo C., Shaji

- Justin

==================
 Justin Willoughby
 Computer Operations
==================

>>> "Justin Willoughby" <jwilloug@mhc.net> 06/27/03 04:00PM >>>

I have a login script that runs the following:

USERIP1=`who am i -R | awk '{ print $6 }' | tr -d \( | tr -d \)`

I use this to find out what IP address a user is coming from. However sometimes this command does not seem to return the correct IP for which they are coming from. If the IP listed in $USERIP1 does not match the IP in a text file then a message is echo'ed when the user logs in.

My questions is has anyone seen any kind of odd behavior with "who am i -R"?

Is there any better solution to finding what IP address a user is coming from then the method I am using?

Thanks!

- Justin

==================
 Justin Willoughby
 Computer Operations
==================

--
             ---> Please post QUESTIONS and SUMMARIES only!! <---
        To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl
       Name: hpux-admin@dutchworks.nl     Owner: owner-hpux-admin@dutchworks.nl
 
 Archives:  ftp.dutchworks.nl:/pub/digests/hpux-admin       (FTP, browse only)
            http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse & search)


This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 11:02:31 EDT