setting REMOTEHOST on rlogins
Rob Warnock
rpw3 at rigden.wpd.sgi.com
Sat Jun 22 08:44:43 AEST 1991
In article <1991Jun21.173050.9868 at umbc3.umbc.edu> bernie at umbc3.umbc.edu
(Bernard J. Duffy) writes:
+---------------
| karl at spruce.gsfc.nasa.gov (karl anderson) writes:
| >I see that when I rlogin to one of our Irises, an environment variable
| >named "REMOTEHOST" is set to the name of the machine I'm logging in from.
| >I'd love to be able to do that on my Suns - can anyone tell me how?
| >as I don't ordinarily take this group. TIA.
| You can make a simple C program that could set this for you...
| The informat for the REMOTEHOST is held in the world readable /etc/utmp
| that the who utility reads for you. Your non-suid (non-prived) program
| can scan /etc/utmp and extract the REMOTEHOST. This would be of use
| to X users because you can make various terminal settings based on
| the originating host...
+---------------
Problems with this:
1. The remote-host field in utmp is only 16 characters, not enough to hold
a long fully-qualified domain name. This means that you can't reliably
use the utmp info to set the $DISPLAY variable (which is one of the most
useful things about $REMOTEHOST).
2. Not all Unices provide the (remote) "host" field in utmp. Sun does.
SGI *doesn't*! [...but we have $REMOTEHHOST]
3. Few (no?) Unices provide utmp entries for "rsh" jobs. Yet many X apps
are run via "rsh".
4. Both the utmp hack and the $REMOTEHOST hack fail on more than one hop.
That is, if from host "A" you rlogin to host "B", and from there you
rlogin/rsh to host "C", the utmp/$REMOTEHOST you see on "C" will point
back to "B". But odds are your X terminal is "A". Oops!
As far as I can tell, the *only* thing which works reliably across multiple
hops and multiple system types is (1) for rlogin, encoding the DISPLAY into
the $term variable (e.g. "set term=rigden.wpd.sgi.com:vt100"), which *is*
propagated by rlogin, setting DISPLAY in your .login file from the $term,
and (2) *always* provide "-display $DISPLAY" on rsh'd commands. [Yes, the
mechanisms for rlogin and rsh are *different*!] Only in this way does $DISPLAY
consistently point back to your real display (instead of some intermediate
black hole).
And the trouble with my (1) is that it requires that the .login file on
*every* machine you rlogin to have the $term-cracking-$DISPLAY-setting code.
This makes it hard to have "generic" open guest accounts, unless all the
guest accounts' .logins have the common $term-cracking hack.
-Rob
-----
Rob Warnock, MS-1L/515 rpw3 at sgi.com rpw3 at pei.com
Silicon Graphics, Inc. (415)335-1673 Protocol Engines, Inc.
2011 N. Shoreline Blvd.
Mountain View, CA 94039-7311
More information about the Comp.sys.sgi
mailing list