CentOS 7 Minimal Installation on Hyper-V: X11 forwarding using Xming and PuTTy error, xhost: unable to open display ":0.0"

8,472
export DISPLAY=:0.0

Don't do that. If ssh is forwarding X, then it will set the DISPLAY variable to the correct value. You're overriding the correct value with ":0.0", which is not the correct value here.

The DISPLAY value ":0.0" means to connect to the default X display running on the same computer. So you're telling your X programs to connect to an X server running on the remote computer (and probably displaying on the remote computer's screen).

If you check, you'll probably find that DISPLAY is already set to "localhost:10" or something similar. That value tells your X applications to connected to the port which SSH has set up to receive forwarded X connections.

As for this:

xhost +

xhost sets access permissions for your X display. It's almost certainly unnecessary for you to run it here, and you're opening your display up for someone else on the network to connect to your display. Don't run this unless you know that it's necessary.

Share:
8,472
Mario Echeverría
Author by

Mario Echeverría

Im a starting this career as a Computer Engineer, my interestings are JAVA, MySQL, ORACLE and SQL Server Databases, but i want to master as a Software Architect in the future...

Updated on November 29, 2022

Comments

  • Mario Echeverría
    Mario Echeverría over 1 year

    Before telling me that there are a lot of post relates to X11 forwarding error, let me put you in context of the things that I have done:

    I have installed the following packages:

    yum install -y xorg-x11-app*
    yum install -y xorg-x11-server-utils
    yum groupinstall -y 'X Window System'
    yum install -y xorg-x11-xauth xorg-x11-fonts-* xorg-x11-utils xterm
    yum -y groupinstall fonts
    

    Also I uncommented the following setting in/etc/ssh/ssh_config

    X11Forwarding yes
    

    On my Windows 8 PC, I ran Xming. Then I checked "Enable X11 forwarding" on PuTTy, and set the X display location to ":0.0". Then I opened PuTTy again and connected to my virtual machine. Then I ran the following:

    xhost +
    export DISPLAY=:0.0
    xclock
    

    This is the resulting error:

    Error: Can't open display: :0.0
    

    Does somebody have an idea what I am doing wrong or what else do I need to fix that problem? Let me tell you that I have done this before but only for CentOS 7 Desktop Installation and it wasn't hosted on a Hyper-V VM.

    Thanks in advance.

    • Jakuje
      Jakuje about 8 years
      why do you do export DISPLAY=:0.0?
    • Mario Echeverría
      Mario Echeverría about 8 years
      I need to Install Oracle 11g, and I want to test in Putty If I am able to display the GUI wizards, and I found on many tutorials that they set DISPLAY to that values.