You are not logged in.

#1 2011-11-13 16:00:53

filam
Wiki Maintainer
From: Portland, ME
Registered: 2008-04-11
Posts: 158
Website

Run an X11 application on a remote machine

I have two computers, a server and a desktop. I would like the server to run an X11 application (i.e. dzen2) on the desktop.

My confusion arises from whether or not to use X11 forwarding over SSH for this task. I only want to send a command from the server to the desktop to be run in an X11 environment. I do not want that application to be sent back to the server or for the application to be run on the server and then sent to the desktop.

When I tried to implement X11 forwarding, as outlined in the ArchWiki, but I received the following error:

$ ssh -X -f <user>@<port> xterm
xterm Xt error: Can't open display: 
xterm:  DISPLAY is not set

Other applications return the same error, only phrased and formatted differently. Xterm's error is unique because it additionally states that the environment variable, DISPLAY, is not set. As one would assume, when I SSH into the desktop, from the server, echo $DISPLAY returns nothing, while running the same command on the desktop returns :0.

The Gentoo Wiki mentions to "Also verify that X is running without the -nolisten tcp option." Which it presumably isn't since  ps only returns X :0 without the aforementioned flag. Previously it mentioned the following:

Gentoo Wiki wrote:

Another explanation for a Can't open display error is that the server is configured not to listen to tcp connections. Check the server is listening by doing netstat -plant ¦ grep 6000. If not, look for where it sets -nolisten tcp (by doing: grep -R nolisten /etc/*) and remove it (I found it in /etc/X11/xinit/xserverrc)

The aforementioned netstat command is confusing. Not only do I not find the -plant flag in the man page, but it inexplicably specifies 6000, which I assume to be a port number.

$ ss -l
Recv-Q Send-Q                      Local Address:Port                    Peer Address:Port   
0      128                         *:x11                                 *:*       
0      128                         :::x11                                :::*       
0      128                         :::at-rtmp                            :::*       
0      128                         *:at-rtmp                             *:*

Any help would be greatly appreciated.

13/11/11 11:02 - Remove random character

Last edited by filam (2011-11-13 16:03:13)

Offline

#2 2011-11-13 16:16:31

b4data
Member
Registered: 2010-12-14
Posts: 141

Re: Run an X11 application on a remote machine

You don't need X11 forwarding. When you are logged in via ssh to your desktop from your server, enter:

export DISPLAY=:0

Then just launch whatever you want to run, in your case dzen2.

Offline

#3 2011-11-13 16:30:09

Gusar
Member
Registered: 2009-08-25
Posts: 3,605

Re: Run an X11 application on a remote machine

filam wrote:

The aforementioned netstat command is confusing. Not only do I not find the -plant flag in the man page, but it inexplicably specifies 6000, which I assume to be a port number.

LOL. There's no -plant flag, there are -p -l -a -n -t flags, which you can specify in short form as -plant. And yeah, X will listen on port 6000, but only if you remove "-nolisten tcp" from /etc/X11/xinit/xserverrc. However you don't need to do this, because like b4data says, X11 forwarding is something else from what you want do.

Offline

#4 2011-11-13 16:39:57

eldragon
Member
From: Buenos Aires
Registered: 2008-11-18
Posts: 1,029

Re: Run an X11 application on a remote machine

enable the corresponding flags in /etc/ssh/sshd_config

then ssh -Y user@server

that should do it.

why -Y and not -X....i dont know.

Last edited by eldragon (2011-11-13 16:40:11)

Offline

#5 2011-11-13 16:45:18

b4data
Member
Registered: 2010-12-14
Posts: 141

Re: Run an X11 application on a remote machine

-Y flag is not needed as OP does not need X11 forwarding.

Offline

#6 2011-11-13 17:11:29

filam
Wiki Maintainer
From: Portland, ME
Registered: 2008-04-11
Posts: 158
Website

Re: Run an X11 application on a remote machine

b4data wrote:

You don't need X11 forwarding. When you are logged in via ssh to your desktop from your server, enter:

export DISPLAY=:0

Then just launch whatever you want to run, in your case dzen2.

Thanks, that confirms what I originally thought.  For some reason I was told on IRC that I needed to enable forwarding, which I went along with despite my skepticism. Oh well.

I was also apprehensive to set the DISPLAY variable because I read that, "Manually setting your DISPLAY environment variable opens your computer up to security risks" (see: Research Computing - What is X11 forwarding?). Although that is within the context of X11 forwarding.

13/11/11 12:23 - Spelling

Last edited by filam (2011-11-13 17:24:47)

Offline

#7 2011-11-13 17:23:31

filam
Wiki Maintainer
From: Portland, ME
Registered: 2008-04-11
Posts: 158
Website

Re: Run an X11 application on a remote machine

eldragon wrote:

enable the corresponding flags in /etc/ssh/sshd_config

then ssh -Y user@server

that should do it.

why -Y and not -X....i dont know.

The difference is explained on the Gentoo Wiki page (see: -X vs -Y). Note that the distinction has security implications.

Offline

#8 2011-11-13 21:11:10

eldragon
Member
From: Buenos Aires
Registered: 2008-11-18
Posts: 1,029

Re: Run an X11 application on a remote machine

filam wrote:
eldragon wrote:

enable the corresponding flags in /etc/ssh/sshd_config

then ssh -Y user@server

that should do it.

why -Y and not -X....i dont know.

The difference is explained on the Gentoo Wiki page (see: -X vs -Y). Note that the distinction has security implications.

thanks! i dont think i need the added security! smile

@OP sorry i thought you wanted to run the gui locally ..

Offline

Board footer

Powered by FluxBB