SSH from Windows to Linux VM. Cannot invoke firefox: no display specified

29,093

Solution 1

If the CentOS machine is remote, you have to specify your IP address where you have X server (i.e. XMing) running when doing "export DISPLAY". Also, you must have the X11 port opened as well.

Your firewall rules may be blocking it, so the best alternative is to use "ssh x11 forwarding" in your ssh client. That will set DISPLAY environment variable upon connection automatically, so the only thing you have to do on your Windows 7 machine is to install the X server (XMing).

For example, if you use Putty, the ssh x11 forwarding can be enabled in Connection - SSH - X11 - X11 forwarding.

Solution 2

Plain SSH will allow you to work with CLI tools like Apache, etc.

For GUI tools, like Firefox, you'll need an X server like xming. SSH will transmit the X "commands" (graphics command like "draw a window", etc.) between Linux and Windows, but you need a X server to actually draw the Firefox window on your Windows machine.

Share:
29,093

Related videos on Youtube

PhiL
Author by

PhiL

I like gaining insight in terms of efficiency and effectiveness. I enjoy coding as a team and taking on projects that push me out of my comfort zone. The stackoverflow community can overzealous at times, but I still love'em. ¯_(ツ)_/¯

Updated on September 18, 2022

Comments

  • PhiL
    PhiL almost 2 years

    I have been at this for the past two days and still no luck.

    $ firefox
    Error: no display specified
    
    $ firefox &
    [1] 25977
    Error:no display specified
    ^C ^C
    [1]+ Exit 1
    

    I am on a Windows7 machine and I'm trying to get Firefox to open on the CentOS machine, but be displayed on my current screen (Windows 7). When typing firefox in terminal, I am getting the following error:

    Error: cannot open display: localhost:0.0
    

    To setup the display I used the command

    $ export DISPLAY=localhost:0.0
    

    Some site suggested using the following, but it didn't work either:

    $ export DISPLAY=:0.0
    

    Do I really need Xming?

    Does anyone know of reliable resources so I can get a better knowledge concerning running applications (e.g. router traffic graphers, Apache, a simple index.html page) off of a virtual machine to be viewed on my desktop via PuTTY?

    I really do not want to download Xming or an X server. Is this necessary?

    I understand when I am run the command firefox or firefox & the server looks for a GUI however it is not "pointed" at my desktop.

    I have used the command export.

  • PhiL
    PhiL over 9 years
    Yes, you are correct. I was able to install XMing, and follow your directions regarding "ssh x11 forwarding."