[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

grab user's ip/tty on login



is there an easy way to grab an user's ip upon login?

i would like my servers to email page me when a user logs in ..but getting
the IP and TTY is prooving more difficult then the date/time and username
:)
what i want is something like this

galactica: $USER logged in at `date` on $TTY from $IP

SSH stores the IP($SSH_CLIENT) ..telent stores the ($REMOTEHOST)
hostname..but 99% of my users telnet
in from dialup and the rest rlogin from the PPP server(shell-only accnts)
so what im lookin for i guess is a script that can look at wtmp/utmp and
get the right info out of it ..i dont think doing a 'w' and
grepping/awking it would work very well if the user is logged in multiple
times..

eventually i would want to check the $IP variable and only email page me
if it is an ip from outside our subnets.

which is easy once i can get the ip in variable form.

any ideas would be appreciated :)

nate


Reply to: