From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96078619210711.tru64-unix-managers.marc@archive.invalid> From: Thomas Leitner Date: Wed, 26 Nov 1997 15:44:59 +0000 To: tru64-unix-managers Subject: SUMMARY: Propagating $DISPLAY through rlogin .... X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96078619210711 Hi, Well: This seems to be a quite common problem as I got a lot of suggestions. They can be summarized like this: 1.) use ssh (http://www.cs.hut.fi/ssh) rather than rlogin 2.) use a wrapper which packs DISPLAY into TERM and unpacks it at the remote site in the .login file of the user 3.) use REMOTEHOST of tcsh (which is what I already do but this doesn't work in the X-Term case) 4.) use a .DISPLAY file in the user's home directory to convey the DISPLAY variable (this assumes an NFS mounted home directory, of course). I think I'll go for the TERM variable wrapper script as I've already got a centralized .cshrc for all users and a centralized rlogin script. So all I need to do is to modify these two scripts like suggested below to get it going. Thanks a lot to: Wesley Darlington "John P.Speno" Kazuro FURUKAWA Jim Belonis Frank Gallacher Peter Stern Stefan Albert Harald Simon Tardell Dejan Muhamedagic Knut Helleb=F8 Here are their answers as well as my original posting quoted in the first answer: ----------------------------------------------------------------------- From: Wesley Darlington Hi Tom, I don't have an answer, I'm afraid. No doubt others will provide you with an elegant solution. However, I get around the problem by using ssh all the time. It does this automatically, but more as a side-effect of what it does very well, namely secure you from packet sniffing and session hijacking; It encrypts all your=20 telnet and X11 traffic. ----------------------------------------------------------------------- From: "John P.Speno" > Short question: When I telnet from my alpha to a sun (and to other Short answer: Use ssh instead of rlogin. :-) http://www.cs.hut.fi/ssh ----------------------------------------------------------------------- From: Kazuro FURUKAWA How about passing DISPLAY in TERM env? TERM is passed both on=20 telnet and rlogin. Thus you can=20 telnet/rlogin script if $DISPLAY =3D=3D (localhost|unix|""):* setenv DISPLAY `hostname`:* setenv TERM $TERM%$DISPLAY telnet/rlogin remote remote .cshrc/.profile if $TERM =3D=3D *%* then setenv DISPLAY "second part of $TERM" setenv TERM "first part of $TERM" some day rlogin also may transfer DISPLAY... ----------------------------------------------------------------------- From: Jim Belonis The only known way is to bundle the DISPLAY environment variable in with = a variable that IS propagated by rlogin. Namely TERM. We used to do this. On the originating machine, just before you rlogin, you setenv TERM ${TERM}.${DISPAY} or something similar, e.g. in a replacement alias or script for rlogin. Then the replacement alias or script should clean up when rlogin is done by fixing TERM again if the originating end has been mangled. Dot is used as the separator since it is unlikely to be a TERM character and can be automatically parsed as if it were part of a filename by the 'History Substitution' modifiers in c-shell. Then during the .cshrc (or other 'dot' file) on the destination machine, you dis-entangle it with something like if ( $?term ) then set disp =3D $term:e # undo merged TERM & DISPLAY variables set temp =3D $term:r if ( $disp !=3D "" ) then while ( $temp:e !=3D "" ) set disp =3D $temp:e.$disp set temp =3D $temp:r end set term =3D $temp setenv DISPLAY $disp unset disp temp endif endif ----------------------------------------------------------------------- From: franx@oas.telstra.com.au Tom, This gets a bit messy, but I have stuff like this in my .login: set WHO =3D `who am i` set TTY =3D `echo ${WHO[2]}|sed s/tty//` setenv REMOTE `w|fgrep " ${TTY} "|tr -s " " " "|cut -f3 -d\ ` setenv DISPLAY ":0" if("${REMOTE}" =3D=3D "localhost") goto quit # # If IP address in valid Class B, Class C , multicast range, # use it; otherwise use default.. # Nb. Fuzzy logic bit!? # set IP =3D `echo ${REMOTE}|tr "." " "|tr ":" " "` if ( `echo ${IP[1]}|egrep '^[0-9]*$'` !=3D "" ) then @ FIRSTOCTET =3D ${IP[1]} if(${FIRSTOCTET} < 128 \ || ${FIRSTOCTET} >=3D 255) setenv REMOTE "172.74.10.77" else setenv REMOTE "${IP[1]}" endif setenv DISPLAY "${REMOTE}:0.0" endif # X Setup.. # Set Pattern for Root Window... xsetroot -bitmap /usr/include/X11/bitmaps/dimple1 >& /dev/null if (! ${status} ) then # Merge resources: xrdb -merge ${HOME}/.Xresources ... etc. If you have a better way of doing this, please could you let me know; som= etimes the thing bombs out and just sets $REMOTE to the IP address of my dear little PC.. Even worse, here is the VMS (yuk!) equivalent bit of my LOGIN.COM: $ REMOTEPORT =3D F$GETDVI("SYS$COMMAND", "TT_ACCPORNAM") $ REMOTE =3D F$EDIT(F$EXTRACT(5,F$LOCATE("Port:",REMOTEPORT)-5,- REMOTEPORT),"COLLAPSE") $ REMOTE_IPADDR :=3D=3D "''REMOTE'" $ SET DISPLAY /CREATE /NODE=3D"''REMOTE_IPADDR'" /TRANSPORT=3DTCPIP $ SHOW SYMBOL REMOTE_IPADDR Hope this is helpful, fcG. ----------------------------------------------------------------------- From: Peter Stern Hi: I know that there are other solutions, but this is what I do. In my .cshrc file I have the following lines: if (! $?DISPLAY) then setenv DISPLAY `who -mM | awk '{print substr($6,2,length($6)-2)}'= `:0.0 endif This, unfortunately, does not work on all versions of unix. But things that work on them, don't work on DU, e.g. =20 setenv DISPLAY ${REMOTEHOST}:0.0 Hope this helps a bit. Peter ----------------------------------------------------------------------- From: Stefan Albert Servus Tom, das gleiche Problem hatte ich auch... ich habe das wie folgt gel=F6st: ich erzeuge per rsh eine Datei (.DISPLAY) auf dem Zielrechner, die=20 mein Display angibt. Das wird dann von .login ausgewertet. Andererseits kann man auch =FCber whoami rauskriegen, "woher" man kommt. Das ist jedoch systemspezifisch. Wenn Du da weitere Infos brauchst, sag mir bescheid. Ich kann Dir auch meine Dateien schicken, die das alles machen... stefan --------------------------------- Translation: He basically suggests to create a .DISPLAY file containing the DISPLAY variable on the target machine using rsh and then process it in the .login file of the user. ----------------------------------------------------------------------- From: hl@tekla.fi I made a script called 'rxterm' which starts a remote xterm keeping things like DISPLAY, CWD etc. A slight variation is 'rstart' which=20 starts any X client on a remote machine. There is also a thing called xon which does about the same. But my script even works agains VMS... --harald ----------------------------------------------------------------------- From: Simon Tardell There is a script that does something like that for rsh, called xrsh, I=20 believe it should be in the contrib directory of the X11 distribution=20 (otherwise I can mail you a copy). It also takes care of xauth stuff, if = you=20 don't share home directories between the local and remote host (and, if y= ou=20 use xauth style authentication). ----------------------------------------------------------------------- From: Dejan Muhamedagic Hi, No, rlogin does not have mechanism to transfer env variables. The only way is to try tweaking .profile on the destination machine and setting DISPLAY var accordingly after you login. Cheers. ----------------------------------------------------------------------- From: Knut Helleb=F8 Regards, I think there are some nice little wrappers floating around the net (unfortunately I don't remember where) that wraps DISPLAY,TERM etc into one,single variable which is unwrapped on the other side. This, however, require that the wrapper is installed in both ends (in e.g. /local/bin/rsh and let /local/bin precede /usr/bin in your users PATH) I know that tcsh have the REMOTEHOST env variable possibility but this is not sufficient in the X-term case. Good Luck ;-) -------------------------------------------------------------------------= - T o m L e i t n e r Dept. of Communications Graz University of Technology= ,=20 e-mail : tom@finwds01.tu-graz.ac.at Inffeldgasse 12 Phone : +43-316-873-7455 A-8010 Graz / Austria / Europ= e Fax : +43-316-463-697 Home page : http://wiis.tu-graz.ac.at/people/tom.html PGP public key on : ftp://wiis.tu-graz.ac.at/pgp-keys/tom.asc or send=20 mail with subject "get Thomas Leitner" to pgp-public-keys@keys.pgp.net -------------------------------------------------------------------------= - Before we have the paperless office, we have the paperless toilet!