X Windows

Remote monitors: xhost

If you are sitting at the console of workstation ``feynman'', but you want to log on remotely to ``simpson'' and run (say) xclock and have the clock appear on feynman's monitor, there has to be some cooperation between feynman and simpson.

On the local computer (feynman in our example) type the xhost command, e.g.,

feynman>   xhost simpson.colorado.edu
Then, after logging on (ssh) to simpson, be sure that the environmental variable DISPLAY is set correctly, e.g.,
simpson>   setenv DISPLAY feynman.colorado.edu:0
simpson>   xclock
In ksh or bash don't use the setenv command; instead,     export DISPLAY=feynmen.colorado.edu:0

 


Remote monitors: xauth

One problem with xhost (above) is that it allows anybody on the remote machine to display X stuff on your local monitor. For this reason some ssh implementations and/or firewalls don't honor xhost. A more secure method of accomplishing the same goal, while allowing only your processes on the remote host to display stuff onto your monitor, is to use xauth. For this, you must go to a bit more trouble just one time, then enjoy a more secure X connection thereafter. You must extract information from your local host, copy it over to the remote host, and add that information to the xauthorization file. Then the ``xhost'' command becomes unnecessary. (But ``DISPLAY'' still must be defined correctly on the remote host.)

Using the example above, but using xauth instead of xhost, you must first find the magic cookie for your local display and save it to a file, using this command:

feynman>   xauth extract cookie.dat feynman.colorado.edu:0
(If the command fails, try the command xauth list to see which cookies are available.) Copy the resulting file, cookie.dat, to the remote computer and then add it to the remote .Xauthorization file using another xauth command:
feynman>   scp ./cookie.dat simpson:
feynman>   rm ./cookie.dat
feynman>   ssh simpson
		...
simpson>   xauth merge cookie.dat
simpson>   rm cookie.dat
From then on, all you have to do is to log on to the remote computer and set DISPLAY.
feynman>   ssh simpson
		...
simpson>   setenv DISPLAY feynman.colorado.edu:0
simpson>   xclock