Off the top of my head I can't think of anything better than system
calls, and my books are at work, but you could simply use another system
command:
$who = `whoami`;
$finger = `finger $who`;
now, if that account has multiple logins, or multiple users using the
same account (tsk on them) you will just have to do more parsing.
check out the man pages. I would think that using `finger -sm $who` is
your best bet with system calls.
-akshay
Bill Pierson wrote:
>
> Good morning, afternoon, or evening depending on when you read this. :o)
>
> To aid in system administration and to track whom is accessing my servers, I wrote a
>little PERL script that is called from /etc/bashrc. As soon as someone logs in, the
>program gets the date and executes:
> $who = `who`;
>
> I then have it E-Mail me who just logged in and at what time.
>
> I'd like to find a way to also have it report to me the IP address from where the
>user is connecting.
>
> If someone could enlighten me as to if PERL would offer this capability, or if there
>is another linux system call that I could use, I would appreciate it. Also, if anyone
>has any suggestions on doing the same thing in a "better" way, I'm all eyes.
>
> Thanks for your time,
> --Bill
>
> PS - Just a quick note - I've been on the list for a few weeks, and I wanted to take
>a moment and thank those of you who have vast knowledge of PERL and are willing to
>share it. Your help is appreciated.
--
http://www.5vs1.com - A Pearl Jam Fan Site
"Only when the last tree is dead, the last river damned, and the last
field paved, will we realize that we can't eat money."
"Time is long and life is short, so begin to live while you still can."
-Eddie Vedder