Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

I have installed Google Chrome with following command line:

$ wget -q -O - | sudo apt-key add -
$ sudo sh -c 'echo "deb stable main" >> /etc/apt/sources.list.d/google.list'
$ sudo apt-get update
$ sudo apt-get install google-chrome-stable

When try to open Google Chrome from command line ($ google-chrome), I am getting following error:

[5426:5426:0808/] Gtk: cannot open display:

enter image description here

How can I fix this issue to open the Google browser?

share|improve this question

marked as duplicate by Eliah Kagan, guntbert, belacqua, Eric Carvalho, muru Aug 9 '14 at 0:09

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 3 down vote accepted

Connecting from Ubuntu and other Unix-like systems with X11-based GUIs

If I understand the situation correctly, you are connecting to a remote EC2 instance (perhaps a "cloud server"). You are probably using ssh.

Installing an X server on the EC2 instance won't help, because you need this application's graphical interface to appear on your end, not on the screen attached to the server. (There probably is no such screen, but even if there were, it wouldn't help you.)

Assuming the machine you're connecting from (i.e., the computer you're physically using) is running Ubuntu or some other operating system that uses the X window system for its GUI, you can use X11 forwarding (ssh -X).

Right now, you're probably connecting to the EC2 server with a command like:

ssh username@hostname

(Where hostname is either the domain name or IP address of the EC2 instance, or perhaps its "simple name" if you're connecting through a VPN.)

To forward X11, change this to:

ssh -X username@hostname

In my experience, remotely controlled GUI applications run via ssh -X often lag perceptibly. You may be able to improve performance by using the blowfish cipher:

ssh -c blowfish -X username@hostname

And unless your connection to the EC2 instance is extremely fast, you may be able to improve responsiveness further with data compression:

ssh -C -c blowfish -X username@hostname

(These can be used in any combination; for example, you could use ssh -C -X username@hostname if you wanted.)

If ssh -X doesn't work, it might be disabled on the server. In that case, open /etc/ssh/sshd_config on the server. Search for a line that says X11Forwarding no and change it to X11Forwarding yes. (If there is no such line, simply add X11Forwarding yes.)

Further reading: How to forward X over SSH from Ubuntu machine?

Connecting from Windows using PuTTY

If you are using PuTTY on Windows (which now appears to be the case, based on the screenshot you've uploaded), then this is still an SSH connection, but you're not using the ssh command so the above client-side syntax won't help you.

Instead, you'll have to:

  • Configure PuTTY to forward X11.
  • Install an run an X11 server on your Windows system.

(Note that while your Windows system is the SSH client and the EC2 instance is the SSH server, it's the other way around for X11: the SSH client runs the X server and the SSH server runs the X client.)

X11 Forwarding using Xming and PuTTY explains how to install the Xming X server on your Windows system and configure PuTTY to forward X11. In short:

  1. Download Xming from its project page.
  2. Install Xming and Xming-fonts (both are included in what you downloaded).
  3. Run Xming.
  4. Run PuTTY, find X11 (it's in the left panel, under SSH, which itself is under Connection). Click on X11.
  5. Make sure the "Enable X11 forwarding" checkbox is checked, the contents of the textbox labeled "X display location" are localhost:0, and the option button under "Remote X11 authentication protocol" is set to MIT-Magic-Cookie-1.
  6. Then connect with PuTTY to your EC2 instance, as normal.

Optionally (and not taken from that source):

  • If you want to use the blowfish cipher, click SSH on the left panel, select Blowfish in the "Encryption cipher selection policy" listbox, and click the Up button until it's at the top of the list. That's essentially the equivalent of -c blowfish if you were using the ssh command.
  • If you want to use compression, then also after clicking SSH on the left panel, make sure the "Enable compression" checkbox, under "Protocol options," is checked.

See also:

share|improve this answer
I have added the screenshot, please check it. – IRAP Aug 8 '14 at 6:57
X11Forwarding yes also is there – IRAP Aug 8 '14 at 7:18
@IRAP It appears you're using PuTTY on Windows. I've expanded my answer to cover that. – Eliah Kagan Aug 8 '14 at 7:41
Thanks a lot, superb... thanks again.. – IRAP Aug 8 '14 at 7:58

protected by Community Aug 8 '14 at 8:15

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.