LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   DISPLAY=:0.0 vs DISPLAY=localhost:0.0 (https://www.linuxquestions.org/questions/linux-newbie-8/display%3D-0-0-vs-display%3Dlocalhost-0-0-a-933940/)

SoybeanStasher 03-11-2012 05:27 PM

DISPLAY=:0.0 vs DISPLAY=localhost:0.0
 
I'm trying to learn more about X11. Omitting the hostname from the DISPLAY variable should imply the server is running locally, yes?

From a terminal running in Ubuntu:
Code:

$ echo $DISPLAY
:0.0

Run 'xeyes' and the window pops up fine. But neither of the following work:
Code:

$ DISPLAY=localhost:0.0 xeyes
Error: Can't open display: localhost:0.0

Code:

$ DISPLAY=127.0.0.1:0.0 xeyes
Error: Can't open display: 127.0.0.1:0.0

Can someone elaborate on why this is?

eeekster 03-11-2012 05:52 PM

With DISPLAY=localhost:0.0 you are asking to connect to an X11 server via TCP. Your X server is most likely not listening on a TCP socket.

jefro 03-12-2012 03:27 PM

I never did get what the OP was asking.

echo something is you telling the system to report. In the first case it is the name of the terminal but that may be that hostname file is not set.

Set it and your terminal ought to then say the name and the ending such as myscreen:0 or on some systems myscreen:0.0

Then run xeyes -diaplay myscreen:0

eeekster 03-12-2012 05:48 PM

Quote:

Originally Posted by jefro (Post 4625092)
I never did get what the OP was asking.

echo something is you telling the system to report. In the first case it is the name of the terminal but that may be that hostname file is not set.

Set it and your terminal ought to then say the name and the ending such as myscreen:0 or on some systems myscreen:0.0

Then run xeyes -diaplay myscreen:0

It doesn't matter what you say in the host file if X isn't listening on a TCP/IP socket and the normal usage is to not do so.

verigoth 03-12-2012 06:48 PM

Run 'xhost +localhost' first. Be careful with xhost..as eeekster eluded to it's generally not a good idea to listen for X connections on TCP.

eeekster 03-12-2012 07:51 PM

Quote:

Originally Posted by verigoth (Post 4625214)
Run 'xhost +localhost' first. Be careful with xhost

That only adds permission for localhost; it does not cause the X server to start listening on an IP socket.

Quote:

as eeekster eluded to it's generally not a good idea to listen for X connections on TCP.
Used to have fun with people at work that didn't restrict access on the Windows based X servers. ;)

jefro 03-12-2012 09:12 PM

should be hostfile not host file.

the echo $DISPLAY :0 proves that there is no name on that terminal.

I assumed that the OP has a gui running such as kde or gnome or such. That may be wrong.

SoybeanStasher 03-20-2012 03:12 PM

I actually did have /etc/hostname set (if that's what you meant), but that doesn't seem to affect whether $DISPLAY contains the hostname or not. This, however:
Quote:

Originally Posted by eeekster (Post 4624258)
With DISPLAY=localhost:0.0 you are asking to connect to an X11 server via TCP. Your X server is most likely not listening on a TCP socket.

helped immensely, since I found this and was able to get a TCP connection (working on an X11 proxy for input fuzzing).

Thanks very much!


All times are GMT -5. The time now is 10:12 PM.