IP address from user SCO OSR 507 - SCO

This is a discussion on IP address from user SCO OSR 507 - SCO ; HI, What command can I use so I can calculate the IP address where a given user is using ?. I can see the IP if I run a finger command here: Login Name Tty Idle Login Time Where alopez ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: IP address from user SCO OSR 507

  1. IP address from user SCO OSR 507

    HI,

    What command can I use so I can calculate the IP address where a given user
    is using ?. I can see the IP if I run a finger command here:

    Login Name Tty Idle Login Time Where
    alopez Anna Lopez 2f5 Thu Apr 10 05:58
    arrowood Tony Arrowood p31 1:15 Thu Apr 10 06:17 mail.nyblock.com
    bbentley Belinda Bentley p13 4 Thu Apr 10 05:24 mylan159
    bcoen Brittnee Coen p44 Thu Apr 10 06:57 mylan176
    beaulieu Ed Beaulieu p32 Thu Apr 10 06:29 192.168.4.60


    I need to get that 192.168.4.60 address somehow? Is there an easy way ?

    What I need is something like this :

    ip beaulieu

    > 192.168.4.60


    Thanks



  2. Re: IP address from user SCO OSR 507

    On Thu, 10 Apr 2008, Enrique Arredondo wrote:

    > HI,
    >
    > What command can I use so I can calculate the IP address where a given user
    > is using ?. I can see the IP if I run a finger command here:
    > ...


    If you are using OpenSSH's daemon, it sets environment variables
    SSH_CLIENT and SSH_CONNECTION. You could easily query and parse these.

    Regards,
    .....Bob Rasmussen, President, Rasmussen Software, Inc.

    personal e-mail: ras@anzio.com
    company e-mail: rsi@anzio.com
    voice: (US) 503-624-0360 (9:00-6:00 Pacific Time)
    fax: (US) 503-624-0760
    web: http://www.anzio.com
    street address: Rasmussen Software, Inc.
    10240 SW Nimbus, Suite L9
    Portland, OR 97223 USA

  3. Re: IP address from user SCO OSR 507

    In article ,
    Enrique Arredondo wrote:
    >HI,
    >
    >What command can I use so I can calculate the IP address where a given user
    >is using ?. I can see the IP if I run a finger command here:
    >
    >Login Name Tty Idle Login Time Where
    >alopez Anna Lopez 2f5 Thu Apr 10 05:58
    >arrowood Tony Arrowood p31 1:15 Thu Apr 10 06:17 mail.nyblock.com
    >bbentley Belinda Bentley p13 4 Thu Apr 10 05:24 mylan159
    >bcoen Brittnee Coen p44 Thu Apr 10 06:57 mylan176
    >beaulieu Ed Beaulieu p32 Thu Apr 10 06:29 192.168.4.60
    >
    >
    >I need to get that 192.168.4.60 address somehow? Is there an easy way ?
    >
    >What I need is something like this :
    >
    > ip beaulieu
    >
    > > 192.168.4.60


    It's not clear to me whether you're specifically after the IP address, or just
    the remote host as shown by finger, regardless of whether address or hostname.
    If it's the latter, you'd get the output you want from this script:

    #!/bin/sh
    who -xP | awk "-vuser=$1" '$1 == user { print $7 }'

    You'll get multiple lines of output for a user logged in multiple times.

    John
    --
    John DuBois spcecdt@armory.com KC6QKZ/AE http://www.armory.com/~spcecdt/

  4. Re: IP address from user SCO OSR 507


    ----- Original Message -----
    From: "Bob Rasmussen"
    Newsgroups: comp.unix.sco.misc
    To: "Enrique Arredondo"
    Cc:
    Sent: Thursday, April 10, 2008 11:05 AM
    Subject: Re: IP address from user SCO OSR 507


    > On Thu, 10 Apr 2008, Enrique Arredondo wrote:
    >
    >> HI,
    >>
    >> What command can I use so I can calculate the IP address where a given user
    >> is using ?. I can see the IP if I run a finger command here:
    >> ...


    No single command is sure fire, but I have a script that looks at a few things and is pretty much always right.

    tellip:

    ----------------------------------
    #!/bin/sh
    #
    # tellip - "Tell IP"
    # prints the IP or Hostname that the user is connecting from.
    #
    # can be run on SCO, Linux, FreeBSD
    #
    # Brian K White - brian@aljex.com - Aljex Software

    # FacetWin places useless pc netbios name into utmp,
    # but supplies the correct info via a variable, so if it exists, use it.
    [ -n "$FACETWINIPADDR" ] && { echo "$FACETWINIPADDR" ; exit ; }

    # "who" tries to show hostname but sometimes chops long names,
    # but openssh supplies the info via variable, so that exists, use it.
    [ -n "$SSH_CLIENT" ] && { echo "$SSH_CLIENT" |awk '{print $1}' ; exit ; }

    case `uname -s` in
    Linux) who -m |cut -d\( -f2 |cut -d\) -f1 ;;
    FreeBSD) who |cut -d\( -f2 |cut -d\) -f1 ;;
    SCO_SV) who -umx | awk '{print $6}' ;;
    esac
    -----------------------------------


    This is intended to be run by the logging in user, as in, I have it in /etc/profile and it sets a variable in their environment, and then I have appliation code that consults that variable.

    Not by say, an administrator wanting to know where user-z is coming from.
    For that you just run who -ux |less
    And be aware that in some cases, such as facetwin, the "from" data in who is basically useless.

    --
    Brian K. White brian@aljex.com http://www.myspace.com/KEYofR
    +++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++.
    filePro BBx Linux SCO FreeBSD #callahans Satriani Filk!


  5. Re: IP address from user SCO OSR 507

    On Apr 10, 7:40*am, "Enrique Arredondo" wrote:
    > HI,
    >
    > What command can I use so I can calculate the IP address where a given user
    > is using ?. I can see the IP if I run a finger command here:
    >
    > Login * *Name * * * * * * * * *Tty *Idle *Login Time * * * Where
    > alopez * Anna Lopez * * * * * *2f5 * * * *Thu Apr 1005:58
    > arrowood Tony Arrowood * * * * p31 *1:15 *Thu Apr 10 06:17 mail.nyblock.com
    > bbentley Belinda Bentley * * * p13 * * 4 *Thu Apr 10 05:24 mylan159
    > bcoen * *Brittnee Coen * * * * p44 * * * *Thu Apr 10 06:57 mylan176
    > beaulieu Ed Beaulieu * * * * * p32 * * * *Thu Apr 10 06:29 192.168.4.60
    >
    > I need to get that 192.168.4.60 address somehow? Is there an easy way ?
    >
    > What I need is something like this :
    >
    > * *ip beaulieu
    >
    > * *> 192.168.4.60
    >
    > Thanks


    I use this script:
    #!/bin/sh
    DLM=' \t- '

    TMPF=/usr/tmp/delme.$$
    w | grep -v ' w' > $TMPF

    trap "rm -f $TMPF >/dev/null 2>&1" 0

    who -x |
    while read usr tty mon day tm node
    do
    grep $tty' ' $TMPF |
    while read x1 x2 x3 x4 x5 x6 pgm
    do
    printf "%-12s - %-8s - %-16s %s\n" $usr $tty $node
    "$pgm"
    done
    done

    the result output sample:
    maxx - ttyp0 - 10.168.1.172 -sh
    wmar - ttyp1 - 10.168.1.177 vi 1.lst

    as I need to know what tty to ip cross reference is.
    Mi

+ Reply to Thread