1847167 Members
6261 Online
110263 Solutions
New Discussion

Re: Display

 
Jiri D
Advisor

Display

When I logon to server I have not set $DISPLAY and I must set it manually.On other unix platforms is $DISPLAY set automaticaly.What can I do for it?

Jirid
3 REPLIES 3
Jiri D
Advisor

Re: Display

I logon to server over ssh2.
Jirid
Tommy Palo
Trusted Contributor

Re: Display

Put the following lines into your .profile:
DISPLAY=your_display:0.0
export DISPLAY
Keep it simple
Steven Sim Kok Leong
Honored Contributor

Re: Display

Hi,

You do not need to specify the DISPLAY variable manually with the use of ssh 2.X.X and sshd 2.X.X.

When you login to the sshd2 server using your ssh2 client, the variable SSH2_CLIENT is automatically set. The values comprise of the quadruple "SSH2 client IP address", "SSH2 client TCP port used", "SSH2 server IP address", "SSH2 server TCP port used".

Thus, to set your DISPLAY variable automatically upon login in your startup script (eg. ~/.profile for sh, bash, ksh), add the following lines:

In ~/.profile (for sh, bash, ksh login shells),

export DISPLAY=`echo $SSH2_CLIENT|awk '{print $1}'`:0.0

In ~/.cshrc or ~/.login (for csh, tcsh shells),

setenv DISPLAY `echo $SSH2_CLIENT|awk '{print $1}'`:0.0

If you do not wish to use awk, you can use cut as well. Instead of awk '{print $1}', use "cut -d\ -f1" in its place.

Hope this helps. Regards.

Steven Sim Kok Leong
Brainbench MVP for Unix Admin
http://www.brainbench.com