moked has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I'm trying to write a script that will set your DISPLAY in a remote session.
However, I could not find a way to run a command (or a set of commands) that will trace back the original machine.
The idea is to trace back the original machine (no meter how many nested "rlogin" there are) and do: setenv DISPLAY <original machine>:view.
I succeeded with one login using the REMOTEHOST variable, but that won't work for nested "rlogin". Does anyone have an idea?

Please assist,
Thanks,
Moked

Replies are listed 'Best First'.
Re: trace back route in linux
by Eliya (Vicar) on Mar 01, 2012 at 09:57 UTC

    It's probably a better idea (for various reasons — security being one of them) to use ssh instead, which provides X forwarding facilities over any number of hops.

    (And if performance matters, you might want to look into using NX (over ssh) instead.)

Re: trace back route in linux
by JavaFan (Canon) on Mar 01, 2012 at 09:52 UTC
    If someone uses rlogin on box A to log in to box B, and then does an rlogin into box C, you cannot retrieve 'A' from C without going into B.