DISPLAY=:0.0 works but DISPLAY=hostname:0.0 does not - Unix

This is a discussion on DISPLAY=:0.0 works but DISPLAY=hostname:0.0 does not - Unix ; I am running Linux (RHEL 4); if I run "xhost +", then "DISPLAY=:0.0", I can bring up an X application (e.g. "xterm"). However, if set DISPLAY=myhostname:0.0, I cannot. I have tried editing /etc/hosts so myhostname is an alias for 127.0.0.1, ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: DISPLAY=:0.0 works but DISPLAY=hostname:0.0 does not

  1. DISPLAY=:0.0 works but DISPLAY=hostname:0.0 does not

    I am running Linux (RHEL 4); if I run "xhost +", then "DISPLAY=:0.0",
    I can bring up an X application (e.g. "xterm").
    However, if set DISPLAY=myhostname:0.0, I cannot.
    I have tried editing /etc/hosts so myhostname is an alias for
    127.0.0.1, and for my actual IP address, with the same results.

    What needs changing?
    Thanks
    Mark


  2. Re: DISPLAY=:0.0 works but DISPLAY=hostname:0.0 does not

    On 2007-06-01, mark.bergman@thales-is.com wrote:
    > I am running Linux (RHEL 4); if I run "xhost +", then "DISPLAY=:0.0",
    > I can bring up an X application (e.g. "xterm").
    > However, if set DISPLAY=myhostname:0.0, I cannot.
    > I have tried editing /etc/hosts so myhostname is an alias for
    > 127.0.0.1, and for my actual IP address, with the same results.


    You probably need to configure the X server to listen for TCP
    connections on the interface inquestion. When you use :0, it's
    using a Unix domain socket instead of a TCP socket.

    --
    Grant Edwards grante Yow! Pardon me, but do you
    at know what it means to be
    visi.com TRULY ONE with your BOOTH!

  3. Re: DISPLAY=:0.0 works but DISPLAY=hostname:0.0 does not

    mark.bergman@thales-is.com wrote:

    > I am running Linux (RHEL 4); if I run "xhost +", then "DISPLAY=:0.0",
    > I can bring up an X application (e.g. "xterm").
    > However, if set DISPLAY=myhostname:0.0, I cannot.
    > I have tried editing /etc/hosts so myhostname is an alias for
    > 127.0.0.1, and for my actual IP address, with the same results.
    >
    > What needs changing?


    You don't want to use "xhost +", because it opens your X server for
    anybody in the world (after you found out how to configure it to listen
    for TCP connections). Anybody could spy on your screen.

    If you want root to be able to open windows on your local X server,

    export XAUTHORITY=/home/of/your/normal/user/.Xauthority

    in root's environment.

    If you want to display windows from remote machines, use "ssh -X"
    or "ssh -Y" instead of telnet or rlogin. With ssh you don't transmit
    plaintext passwords, your X server does not need to listen for TCP
    connections and you don't need to set DISPLAY.

    Regards...
    Michael



  4. Re: DISPLAY=:0.0 works but DISPLAY=hostname:0.0 does not

    On Jun 1, 3:56 pm, mark.berg...@thales-is.com wrote:
    > I am running Linux (RHEL 4); if I run "xhost +", then "DISPLAY=:0.0",
    > I can bring up an X application (e.g. "xterm").
    > However, if set DISPLAY=myhostname:0.0, I cannot.
    > I have tried editing /etc/hosts so myhostname is an alias for
    > 127.0.0.1, and for my actual IP address, with the same results.
    >


    I had the same problem a few days ago and someone here helped me fit
    it,

    I made some training notes so here they are.

    --------------------------------------------------------
    USING X OVER TCP/IP (Debian and others )
    ---------------------------------------------------------

    Because a remote TCP/IP socket connection without encryption is
    insecure and prone to eavesdropping the default setting for X disables
    the TCP/IP socket.

    Use the following command to verify your current X server setting :

    # find /etc/X11 -type f -print 0 | xargs -0 grep nolisten

    if you see the following

    /etc/X11/xinit/xserverrc:exec /usr/bin/X11/X -dpi -nolisten tcp

    then X is set not to listen for TCP/IP socket connections.

    Edit /etc/X11/xinit/xserverrc and remove "-nolisten tcp" and then
    restart X.

    A reboot will be the quickest way for a workstation.

    For security reasons this is usually not advised and it is suggested
    you use ssh instead.

    Connecting to a Remote X server ( insecure method )
    -------------------------------------------
    On the X server (just remember the X server is where you can actually
    view the application window running and interact with the program )
    execute xhost+ after you have removed "-nolisten tcp" and restarted X.

    On the X client (just remember the X client is where the program will
    actually be running although you wont see its window ) you need to set
    your DISPLAY environment variable like so:

    # export DISPLAY=192.168.0.4:0.0 (substitute the IP address of your
    own X server for 192.168.0.4)

    Now the client can run programs like xcalc and the display will show
    on the X server even though the process is running on the client. Do a
    'ps ax | grep xcalc' on the client and X server just to verify this
    for the sake of your own curiosity.

    However this approach is insecure and thus obsolete.

    For security reasons this is usually not advised and it is suggested
    you use ssh instead.

    Connecting to a Remote X server ( secure method )
    ------------------------------------------------------------------------
    The secure way to run X windows these days is using ssh or secure
    shell.

    The approach this time is slightly different.

    We need to run the ssh server (sshd) on the computer where the
    application will actually be running .
    Before you start the sshd program make sure that the sshd_config file
    (usually /etc/ssh/sshd_config or /etc/sshd_config ) has the following
    entry :

    X11Forwarding yes

    This is needed for the ssh server to send the display back to your
    workstation over the ssh connection.

    If the sshd_config file doesnt have this entry then add it and start
    the ssh server :

    # /etc/init.d/sshd start (will vary from distro to distro : man sshd )

    Now sitting at your X server (i.e. your workstation where you want the
    application to display and interact with ) connect to the ssh server :

    # ssh -X username@192.168.0.9 (-X or -Y will both work).

    replace username with a valid account on the computer running the ssh
    server.
    replace 192.168.0.9 with the IP address of the ssh server.

    Now from your ssh session you can run an X application like xcalc on
    the ssh server and watch it magically appear on your screen. Do a 'ps
    ax | grep xcalc' on both computers just to satisfy your curiosity as
    to where the application is running and where it is being displayed.



  5. Re: DISPLAY=:0.0 works but DISPLAY=hostname:0.0 does not

    On 1 Jun, 23:55, navti wrote:
    > On Jun 1, 3:56 pm I wrote:
    > > I am running Linux (RHEL 4); if I run "xhost +", then "DISPLAY=:0.0",
    > > I can bring up an X application (e.g. "xterm").
    > > However, if setDISPLAY=myhostname:0.0, I cannot.


    On 1 Jun, 23:55, navti replied:
    > # find /etc/X11 -type f -print 0 | xargs -0 grep nolisten
    > /etc/X11/xinit/xserverrc:exec /usr/bin/X11/X -dpi -nolisten tcp
    > then X is set not to listen for TCP/IP socket connections.
    > Edit /etc/X11/xinit/xserverrc and remove "-nolisten tcp" and then
    > restart X.
    > For security reasons this is usually not advised and it is suggested
    > you use ssh instead...


    Thanks very much for that (and other replies).
    In RHEL, I found /etc/X11/gdm/gdm.conf (Gnome desktop config file)
    which has "DisallowTCP" option, defaulting to "true" - causes X to be
    run with "-nolisten tcp" parameter, which means that
    DISPLAY=myhostname:0.0 is not acceptable. If this is changed to
    false, it becomes acceptable.

    However, a number of ways of starting up X avoid using this config
    file (and this is what was confusing me), e.g.
    1) If machine starts in run-state 3 (i.e. initdefault in /etc/inittab
    is 3), so login & run "startx"
    2) If gdm.conf contains DefaultSession=mwm.desktop (not
    =default.desktop)
    3) If file .dmrc in user's home directory has: session="mwm"
    [Note that I think I am correct about these, but I have been making
    lots of changes to the system in my investigation, so I may have got
    confused! I have another question, but I'll start a new thread for
    that]

    Mark



+ Reply to Thread