On Fri, 13 Apr 2007 21:51:59 +1000, Amos Shapira wrote:
>
> Also, my question was less about how to get the data - ssh with a special
> identiy and a limited command looks easier and more secure - but more on how
> to get the ip address used by the ssh client at work.
It is very VERY simple, just use the SSH_CLIENT env variable.
Here is a script I use to have my HOME IP saved:
#! /bin/sh -ex
#
# Saves IP of ssh caller (use env var: SSH_CLIENT) to file ip_no
#
# --------------------------------------------------
IP=`echo $SSH_CLIENT | cut "-d " -f1`
if [ "$IP" != "" ] ; then
echo "$IP" > ip_no
fi
date "+%Y-%m-%d %H:%M ip set on $SYS" >> ip_log
############################## save-ssh-ip.sh ##############################
Ehud.
--
Ehud Karni Tel: +972-3-7966-561 /"\
Mivtach - Simon Fax: +972-3-7966-667 \ / ASCII Ribbon Campaign
Insurance agencies (USA) voice mail and X Against HTML Mail
http://www.mvs.co.il FAX: 1-815-5509341 / \
GnuPG: 98EA398D <http://www.keyserver.net/> Better Safe Than Sorry
=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]