1821410 Members
2687 Online
109633 Solutions
New Discussion юеВ

SSH and export DISPLAY

 
Oliver Schmitz
Regular Advisor

SSH and export DISPLAY

Dear all,

I log in to my hpux system with ssh. On other maschines I am used to see my DISPLAY exported automatically. In my case this is not apearing. The DISPLAY is empty.

What do I have to check to correct this behaviour. Thanks for any hints,

Oliver
Oliver Schmitz
6 REPLIES 6
Jorge Fabregas
Regular Advisor

Re: SSH and export DISPLAY

Hello Oliver,

What ssh client are you using? I'm using the ssh client that comes with Red Hat Linux. When i want to enable X11 forwarding, I use the -X switch to the ssh command. That is:

ssh -l MyUsername ServerIpNumber -X

and then I can run all X applications and I'll see them on my local X Server. Doing this (using the -X switch argument) will set my DISPLAY variable on my session.

Also, check on your server this file:

/opt/ssh/etc/sshd_config and verify the value for X11Forwarding. Make sure it has "Yes" as its value. Otherwise, you won't be able to tunnel X11 connections.

Hope that helps,
Jorge
Tomek Gryszkiewicz
Trusted Contributor

Re: SSH and export DISPLAY

Hi,
add to your .profile entry:
export DISPLAY=:0.0

who -Rm shows your ip, you can script it if your ip is changing.

-Tomek
James Specht
Trusted Contributor

Re: SSH and export DISPLAY

I have this in my profile to cover the different workstations I might be coming from.

wow=$(who -m -R|cut -d'(' -f2|cut -d ')' -f1)
export DISPLAY=$wow":0.0"

--Jim
"Everyone can be taught to sculpt: Michelangelo would have had to be taught how not to. So it is with the great programmers."
Tomek Gryszkiewicz
Trusted Contributor

Re: SSH and export DISPLAY

You can add something like this to your .profile:

ip=`who -Rm|awk -F'(' '{print $2'}|awk -F')' '{print $1}'`
export DISPLAY=$ip:0.0
Oliver Schmitz
Regular Advisor

Re: SSH and export DISPLAY

Thank you for this hints so far.

Unfortunately I did not manage to bring it up running. I modified the /opt/ssh/etc/ssh_config file (Uncommented the line with ForwardX11 and changed to yes) and I used the ssh -i myname servername -X.

Nothing changed at all. When I type echo $DISPLAY I receive empty blank line.

The solutions with the profiles are good ideas. I realized this way of X11 forwarding within my userprofiles on the maschines. But other userswho are not so familiar with unix asked me for setting up the automaticall forwarding.

Thanks for more hints in advance.

Best regards,

Oliver
Oliver Schmitz
Alzhy
Honored Contributor

Re: SSH and export DISPLAY

For your slient machine (where you ssh from) either do a ssh -X or edit your ssh_config file so it always has that parameter)
.
On the servers you connect to, you need to edit sshd_config in /etc/ssh (or whereever you store it)and enable X forwarding..
.
These is the key... your DISPLAY envar will not actually be set to your originating client machine but to localhost:10 or someting dependng on how you set up your sshd_config.
.
.
HTH
Hakuna Matata.