Archives for: dicembre 2012

Get IP address of SSH remote user

To get the remote IP can

—————————————————————————————
IP_SORG=`last |head -1 |awk ‘{ print $3 }’`
echo ” Sei collageto dall’indirizzo: $IP_SORG”
—————————————————————————————
other way
—————————————————————————————
HOST=`who am i | sed -r “s/.*\((.*)\).*/\\1/”`
IP=`host $HOST | sed -r “s/.* has address (.*)/\\1/”`
——————————————————————————————
other way
——————————————————————————————-
echo $SSH_CLIENT | cut -d ‘ ‘ -f 1
oppure
echo $SSH_CONNECTION | cut -d ‘ ‘ -f 1
——————————————————————-

share save 120 16 Get IP address of SSH remote user