On Wed, 28 Apr 1999, Jonathan Arehart wrote:
> Hello all,
>
> I'm working on a python script at the moment that will write the date and
> location from which I log in each time I do so. However, I've not found
> an easy way to get the IP address or hostname from which I'm connecting
> that is consistent across Un*ces (Linux and FreeBSD in my case). I've
> thought about parsing the information out of finger output which is
> possible but kinda annoying. The other option I've found is using the
> output of last -1 <username>, but if the hostname is very long, I can't
> get all of it and would like to.
last -1 username could still lead to an incorrect result in the case
when someone logs on with your userid right after you, causing it to log
the wrong entry twice. Or equally likely, you log in right after someone
logs in as you, missing the other entry completely.
> I have found that if I'm using ssh or my shell is tcsh, I can get the
> full address from and environment variable, but I almost never use tcsh
> <grin> and don't ssh to my machine when I'm behind my ip-masq at home.
Where is tcsh getting this information? I would check on that to see
if it's getting the environment passed from the login program or if it's
looking it up itself or what. There is no sense being paranoid if you
blatantly trust some strange environment settings.
Adam
---------------------------------------------------------------------------
Send administrative requests to [EMAIL PROTECTED]