Summary: Getting client IP address from shell

From: Hutcheson, Mike <Mike_Hutcheson_at_baylor.edu>
Date: Fri, 31 Jan 2003 13:50:34 -0600

Fantastic! I received several very helpful responses to my question about getting the client IP address from the shell during a telnet or ssh session. The list of respondents is long so to keep things short I'll just say thanks to everyone who replied.

The simplest solution that I received from several people was to use the who -m command and pipe it through awk and sed.

#!/bin/sh
client_addr=`who -m | awk '{ printf $NF }' | sed 's/[()]//g'`

Thanks again!

Mike Hutcheson (Mike_Hutcheson_at_baylor.edu)
Systems Manager (254) 710-4110
Baylor University - Information Technology Services
Received on Fri Jan 31 2003 - 19:51:16 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:44 NZDT