PDA

View Full Version : [ubuntu] ---Cannot run graphic program over ssh tunnel !



bzhao
April 16th, 2012, 07:31 AM
I am not sure if here is good place to put my question.


I use "ssh -Y -p 2222 access myserver_name" to access my server.

and I often run "bless", "bcompare", etc at the ssh teminal and see the graphic result on my local ubuntu desktop.

This morning I found that I cannot do that. the run program exit and the error info on the termial is:
Gtk-WARNING **: cannot open display:

I tried to recall what I have done to the server, and tried to remove some changes I have done. the result is the problem is still there.

In an addition I have another server which run the same version of Ubuntu 11.04 as the one I have the problem with. it work very normally. I also compare the config file between the 2 server. I cannot see what problem is.

I also see the log in /var/log/syslog file, no erro info there

I am going crazy for the problem! I really need to run graphic program remotely!

Please help how to debug the problem.

Thank indeed!

Bill Z

markbl
April 16th, 2012, 07:48 AM
I use "ssh -Y -p 2222 access myserver_name" to access my server.

What is "access" in the above command? Hopefully some typo.

Anyhow, after you ssh in to that server using the above command then type the following at the myserver_name command line:


echo $DISPLAY

That may give you a hint to the problem.

Irihapeti
April 16th, 2012, 09:25 AM
You need to include the option -X in your command to forward X.

If you're using connections regularly, it can be worth setting up launchers. I have several launchers set up for particular programs that I use on my LAN at home. The commands look like:


ssh -f -T -X foo /path/to/program

"foo" is shorthand for the connection information and is defined in ~/.ssh/config like this:


Host foo
HostName yourmachinename (you can use IP address instead)
Port 55555
User yourname

When you connect, it will ask you for your password, or your ssh key passphrase if you are using keys.

bzhao
April 16th, 2012, 03:30 PM
Thanks for your responses!

For debugging in ssh terminal:

"echo $DISPLAY" give me nothing of printting,

while I got "localhost:11.0" on my normal server.

then I try run "exprort DISPLAY=localhost:11.0",
and then I still have the same problem. error info is still the same:
"(bless:12785): Gtk-WARNING **: cannot open display: localhost:11.0"

markbl
April 17th, 2012, 02:25 AM
Did you add the -X as suggested above? I personally just add "ForwardX11 yes" to my ~/.ssh/config in the global top section.

Make sure "X11Forwarding yes" is set in your servers /etc/ssh/sshd_config. Run "sudo service ssh restart" after you change that file.

You can't just manually set DISPLAY. It must be set automatically by ssh then you know the X tunnel has been set up.

bzhao
April 17th, 2012, 05:18 AM
Did you add the -X as suggested above? I personally just add "ForwardX11 yes" to my ~/.ssh/config in the global top section.
I did try -X funtion, it did not work.
I also add a line of "ForwardX11 yes" in /etc/ssh/ssh_config, it does not work eighter

Make sure "X11Forwarding yes" is set in your servers /etc/ssh/sshd_config. Run "sudo service ssh restart" after you change that file.

Yes, Ubuntu ship ssh with it as default.

You can't just manually set DISPLAY. It must be set automatically by ssh then you know the X tunnel has been set up.
Yes, I got it