• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

SSH help

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

D $hady

Member
Joined
Feb 11, 2003
Location
/home/USA/NH
Hi,

I've got a quick question about using SSH and a remote display.

Let's say I have a Linux box running an X server (and KDE) connected to a monitor.

What I want to do is SSH into that machine and run an application that can only run in an X environment. Currently, when I run a command in an SSH session (in this case mythfrontend from MythTV), I get "mythfrontend: cannot connect to X server" (duh!).

So how to I get that app (mythfrontend) to run on the X server being used by the monitor? I'm guessing it's easy but I'm stuck.

Thanks,

Dave

(I hope I got all my Linux lingo correct :p )
 

injinj

Member
Joined
Dec 12, 2003
Location
San Francisco
Normally, ssh sets the DISPLAY variable to localhost:X.0 and exports that back to the connecting host, which would be where your display is.

You can try the insecure way to see if it's an ssh problem or an X problem.
On the local machine, let remotehost connect:
$ xhost +remotehost
Where remotehost is an IP address or a hostname.
On the remote machine:
$ export DISPLAY=myhost:0.0
$ xterm
Where myhost is a IP address or a hostname.
Start something simple, like xterm, before trying mythfrontend. It's possible mythfrontend is using fancy hardware accelerated graphics that can't be done remotely.

See http://www.linuxfocus.org/English/January2002/article222.shtml for a good descrtiption of the above.

If that works, then ssh is having problems exporting the connection back to the local machine. Make sure you can start an X client before ssh-ing over to the remote machine. It may be that your DISPLAY is wrong or is set incorrectly and ssh is exporting that setting.
 

tamasrepus

Registered
Joined
Aug 22, 2002
Location
Las Cruces, NM, USA
Easy, secure, fast way:

Invoke ssh with (can also be set with config files):
ssh -X -C hostname

And then run programs on the remote machine. ssh automatically creates an X proxy on the remote machine, tunneled over SSH, back to the X server on your machine. It also sets DISPLAY correctly and so on. Be aware that remote X over anything that isn't LAN tends to be slow.
 

nil_esh

Member
Joined
Nov 7, 2001
Location
Tampa, FL
Also, on your remote machine, you may have to edit /etc/ssh/sshd_config and add or uncomment this option:

X11Forwarding yes