On Wed, Mar 28, 2007 at 03:04:39PM +0100, Jonathan McDowell wrote:
On Wed, Mar 28, 2007 at 11:32:19AM +0100, Chris G wrote:
Does anyone have any neat/elegant/clever ways of setting the DISPLAY variable when working in a situation where I may use X in different places and want to run X applications from different remote machines?
...
So how is one *supposed* to make this all work?
Use ssh everywhere? You mention rlogin; how are you passing around your xauth cookies? (Please tell me the answer isn't "I have xhost + set" unless you work alone and no one else has access to your network.)
At work the network is behind a firewall and all the Solaris/Linux machines are development machines with no sensitive personal information so it's fairly relaxed. The Linux boxes use ssh so environment set up is easier there but the old Solaris boxes only have rlogin/rsh. I set up specific machine access using .rhosts and X using 'xhost +name'.
I think I have a reasonable fix for my problem:-
In my .xinitrc I set the DISPLAY variable to `hostname`:0.0
Also in .xinitrc I create a little script (using echo) that will set the DISPLAY variable correctly.
In my .kshenv (also known as .kshrc) file I test to see if DISPLAY is set and, if it isn't, run the script created by .xinitrc.
This will work on all machines where my home directory is visible and won't break ssh DISPLAY setting (the test to see if it's set).
The only cases when it won't work are if I have two X sessions running on different machines (very unlikely) and from machines where my home directory isn't visible which I can probably deal with 'manually'.