Privacy and Security Notice

Archived Messages for NCD_USERS_1997@cebaf.gov: Re: NCD-USERS: how to get IP address of X-terminal when su'ed

Re: NCD-USERS: how to get IP address of X-terminal when su'ed

Bob Clark (rlclark@usa.net)
Fri, 10 Oct 1997 23:16:07 -0400

This might work for you:

DISPLAY=`who am i | sed 's/^.*(\(.*\))/\1/'`

Marvin Newhouse wrote:
>
> How can a UNIX shell script or program determine the IP address (or name)
> of an X-terminal where the user is sitting... when the user
> must do an rlogin (or a "full" su) to another system (or user)
> in order to run the program.
>
> I know the following:
> If you use XDM or CDE for logging in then the user environment variable DISPLAY
> is automatically set and could be exported or passed to the called program.
> In CDE, another environment variable, DTUSERSESSION contains the user and display name.
>
> BUT, if you do an rlogin or a "full" su (by doing an 'su - username') to
> another host or user... those environment variables are lost (even if exported).
>
> SO ... the question again:
> Is there a UNIX system command (in particular Solaris 2.5) that can traceback
> to the IP address that the login or su came from? i.e. the X-terminal.
> That info must be stored somewhere so that packets make their way
> back to the X-terminal.
>
> Thanks,
> Marvin Newhouse
> | Internet: marnew@welchlink.welch.jhu.edu
> The Johns Hopkins University | Voice: (410) 955-1471 or -8318
> Wilmer Clinical Trials & Biometry | Fax: (410) 955-0569
> Baltimore, MD
>
> --------------<< "ncd-users@ncd.com" FOOTER MESSAGE >>-------------------
>
> To Unsubscribe: Email ncd-majordomo@ncd.com with "unsubscribe ncd-users".
> Anonymous FTP Site: ftp.ncd.com - unsupported host binaries, tech notes, etc.
> WWW Site: http://www.ncd.com/ - product,service & company info
> Archive of List: Use "index" and "get" commands to ncd-majordomo@ncd.com
>
> NCD reserves the right to restrict access to this list.

--------------<< "ncd-users@ncd.com" FOOTER MESSAGE >>-------------------

To Unsubscribe: Email ncd-majordomo@ncd.com with "unsubscribe ncd-users".
Anonymous FTP Site: ftp.ncd.com - unsupported host binaries, tech notes, etc.
WWW Site: http://www.ncd.com/ - product,service & company info
Archive of List: Use "index" and "get" commands to ncd-majordomo@ncd.com

NCD reserves the right to restrict access to this list.