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

I have an Ubuntu server (12.04 LTS) running remotely on a cloud hosting service. I have installed ubuntu-desktop via apt-get:

$ sudo apt-get install ubuntu-desktop

It appears to have installed no problem.

I have confirmed that /etc/ssh/ssh_config on the server contains the lines

ForwardAgent yes
ForwardX11 yes
ForwardX11Trusted yes

and that /etc/ssh/sshd_config on the server contains the line:

X11Forwarding yes

I then rebooted the server. It came back up no problem.

Now, starting on my Mac I am presented with an Xterm.

I connect to my server from this terminal using:

$ ssh -X <myhost>

and I connect to the server, no problem.

At this point I don't know what to do. I have tried

$ sudo startx

but I get a "no screens found" error.

I don't have screens because its a headless cloud server, but I just want to acces it from my Mac through X.

What now?

share|improve this question
Try installing xvfb. I am not experienced with it, but it acts like a screen without hardware. – hexafraction Jul 13 '12 at 13:01

There are several methods to accomplished that, depending of what you really need to do.

In order to forward remote apps to local X environment, you need to install X11 on your Mac (you can find it at apple support site):

From the X11 app, open the terminal, and then access the remote host with:

    ssh -XC user@host

Then, when logged, simply run the command for the desired app, ex: firefox, nautilus, thunderbird, whatever...

You can even launch only the system (Ubuntu, Xubuntu, Mint, etc..) Main Menu, and interact with the remote system from there, without the need of a full graphical front-end. On a remote Linux Mint env, i simply run:


If you really need it, you can even start the remote graphical environment locally at your Mac's X11, simply running:

    etc... (depends of your remote environment)

Better than any VNC, even better than an X11VNC connection! Secured and compressed connection FTW.

share|improve this answer

On your Mac, you'll need to install XQuartz, if you haven't done so already (see Once that's installed, reboot and open an XQuartz terminal window and SSH to your Ubuntu Server system:

ssh -X yourubuntuserver

If lightdm is running (see to read how turn it on and off as needed), run this command to get Ubuntu Unity tunnelled to your Mac over X11:

gnome-session --session=ubuntu-2d

This works for me with Ubuntu Server 12.04 LTS and Mac OS X Mountain Lion 10.8.2, but I do get occasional Composiz errors. That said, I always got Composiz errors when running Ubuntu Desktop locally, too. (-:

You can log out of Unity to close the Ubuntu Desktop windows.

share|improve this answer

You have the right idea but the wrong syntax :)

startx will not start over an ssh like that because it needs a screen (aka X server to talk to)

try this command to start the desktop gui

sudo service gdm start

this will start the desktop environment.


and try

ssh -X nautilus username@host 

note did not test above line

If everything works fine you should see the ubuntu file manager popup. If not you may be missing some librarys or the syntax of the command is wrong (of the top of my head didn't try it).

share|improve this answer
There's no need (or reason) to run sudo service gdm start. The X server runs on the SSH client--the machine being used as a workstation. It doesn't need to be running on the remote machine for ssh -X to work. – Eliah Kagan Jul 23 '12 at 0:18
Ah I was not aware of this thank you for the info. – Matt Mootz Jul 24 '12 at 19:55
+1 for the Eliah's comment – Paulo Coghi Jan 29 '15 at 18:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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