[lug] Problem with $DISPLAY script and SSH.

Nate Duehr nduehr at inflow.com
Thu Feb 3 12:26:20 MST 2000


"Harris, James A (Jim)" wrote:

<snipped...>

> DISPLAY=$REMOTEHOST':0.0'; export DISPLAY
> 
> Insanely simple, I know.  :)  Here's the problem I'm running into:  when I
> log in using SSH this little export is overwriting the DISPLAY variable that
> the SSH client sets up for X11 forwarding.  (It sets the DISPLAY variable to
> LOCALHOST:10.0)  I'm looking for a way to make the script intelligent enough
> to detect that I'm coming in from SSH and not reset the variable if I am.
> Since SSH comes in through port 22, I thought a simple logic statement that
> says "if it's comin' in from 22, don't run the next line" would work, but
> I'm not sure how to do that.  (I'm not terribly competent with shell
> scripting yet.)

Jim,

You probably realize this already, but just in case... DISPLAY 10.0 is
the default that SSH sets up because it creates an SSH tunnel if
X-forwarding is turned on.

Running X programs (or even whole window managers) is possible and
they'll show up on the local machine you connected from if your
X-forwarding settings are correct in SSH.

You may want to look into the compression settings in SSH if you're
doing this over a slow link, I believe that SSH can do the equivalent of
gzip -9 compression to the X stream before sending it... at the cost of
CPU cycles.

Almost as good as a real VPN.  :)

Nate





More information about the LUG mailing list