39

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 X11.app 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?

1
  • 2
    Try installing xvfb. I am not experienced with it, but it acts like a screen without hardware.
    – nanofarad
    Jul 13, 2012 at 13:01

3 Answers 3

22

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): http://support.apple.com/kb/DL1605?viewlocale=en_US&locale=en_US

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:

    mintmenu&

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

    ubuntu-session
    xubuntu-session
    etc... (depends of your remote environment)

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

9

On your Mac, you'll need to install XQuartz, if you haven't done so already (see http://xquartz.macosforge.org). 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 https://askubuntu.com/a/153423/66799 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.

2
  • This works, XQuartx is necessary.
    – SmallChess
    Jan 13, 2017 at 1:51
  • Works great on Windows 10 in WSL with Xming for display.
    – Harsh
    Sep 17, 2017 at 8:41
-1

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.

disconnect.

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).

2
  • 6
    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. Jul 23, 2012 at 0:18
  • Ah I was not aware of this thank you for the info.
    – Matt Mootz
    Jul 24, 2012 at 19:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .