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

firefoxlinuxputtyssh

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.

Best Answer

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.

Related Question