44

I have a ubuntu development server at work. It is an old rack server that is located somewhere in the company's dungeon, where nobody ever goes. The only way it can work is as a so-called headless server (i.e. with no monitor/keyboard connected and only accepting network connections).

Obviously, if you just need terminal access ssh is more than enough. I, however, would also like to connect to the graphical interface from time to time. At the moment I am using the built in VNC functionality but I am pretty sure this is neither the most efficient nor the most secure way of approaching this issue.

I have done a bit of research on the issue but failed to come to any definite conclusions. I read about trying to forward the X environment over ssh, which would at least solve my security concerns. Can anyone share their experiences in setting this up? Is there any other way that might be worth looking at?

I almost exclusively connect to this server from a Windows machine. I don't know if that might be a problem for some of the methods suggested.

9 Answers 9

22

Yes, X forwarding over ssh is a beautiful thing indeed. It allows you to use graphical applications on an app by app basis and have windows handled by your own desktop environment. You do not even need a desktop environment installed on the server.

You do need to set up some authentication things for it to work though. I believe you need xauth for that.

It's SO much faster than VNC as well. VNC was always rather laggy in my experience.

Edit: I have no experience using this method via Windows, but I found this tutorial for you if you're interested.

5
  • 2
    "ssh -X <server> <program>" should set up everything (I've never needed to touch xauth myself, though it does need to be installed in order for the -X option on ssh to work). Jul 28, 2010 at 19:46
  • @Suppressingfire: Oh thanks. I guess I should have included the command myself.
    – DLH
    Jul 28, 2010 at 19:48
  • 2
    Yes, X forwarding works with windows. I have used it with Cygwin/X, on Windows XP. Not the fastest or prettiest, but does work.
    – mp3foley
    Jul 28, 2010 at 20:53
  • ssh X11 forwarding also limits what services you have to enable on your server! I suspect most servers have ssh anyways. Enabling remote X11 (XDMCP) isn't really known for being secure. Aug 7, 2010 at 9:55
  • 1
    the tutorial link is now broken, mind someone who can update it?
    – owl
    Feb 23, 2016 at 4:42
12

You could use freenx instead of vnc. Freenx transmits x-commands (with caching) instead of bitmaps.

2
  • Can I use it on a Windows machine?
    – silvo
    Jul 28, 2010 at 19:56
  • 2
    I believe you can download the NoMachine NX client for Windows and that it works with FreeNX- though I could be wrong. nomachine.com/download.php
    – manyxcxi
    Jul 28, 2010 at 22:26
10

Xming and XDMCP is a brillant option.

Edit:

Xming is a x-server for windows, which is based on Cygwin and has the ability to share the clipboard and implements different desktop layouts as well.

XDMCP is a simple and - important - unencrypted protocol (don't use it over the internet) to connect a X-displaymanager and a x-server.

2
  • You probably should edit the answer to include a bit more details on why and how this works. Knowing what Xming and XDCMP mean this is the best choice.
    – Ressu
    Jul 30, 2010 at 6:23
  • I will do that.
    – ddeimeke
    Jul 31, 2010 at 9:05
8

I don't know about the "best" way, I guess YMMV, but here's a fairly comprehensive overview of tools at your disposal: http://www.mynitor.com/2010/02/07/15-remote-desktop-solutions-for-linux/

I particular here's my experience:

  1. nomachine nx - Impressive speed. In its native mode it feels like you're in front of the console. It supports starting new sessions as well as shadowing the console (but shadowing is slower). It supports detaching and attaching to sessions. Clipboard sharing only worked one way for me and I wasn't able to fix it. nomachine offers free server and client packages with some licensing restrictions.
    FreeNX is built on the nomachine nx libraries

  2. x2go - Impressed with this also especially sound redirection but I didn't use it for as long as nomachine nx because I found out about it later.

  3. x11vnc - Great vnc server that is able to attach to the console session. Used it in conjunction with nomachine nx. I'm not sure if it can be run in headless mode but I'm listing it in case it can, because for me it was the fastest vnc server around.

  4. xrdp - Looked promising but it looks to be unmaintained. The OpenSuse nomad solution is based on xrdp and I hear nomad is the best remote desktop experience you can get on linux.

  5. teamviewer - The linux version is still beta, runs under wine and consumes some CPU but I used it a lot quite recently and I was pleased with it. Not sure if it works on a headless server.

4

Also consider xpra, which allows you to detach to an running session from somewhere else, like "screen for X".

There's also Window Shifter, a front end for xpra, which should work also for Windows, see the demo.

1
  • 1
    This looks interesting.
    – Li Lo
    Aug 5, 2010 at 23:26
1

While inherently insecure, you could use XDMCP over a local network. I use it frequently to access virtual machines. Its just like logging on to your desktop, except you chose the remote server.

1

I use x11vnc, which works very well for me. It lets you keep a persistent graphical session between connections, so you can disconnect and reconnect and everything will be just the way you left it. It also supports tunneling over SSH. See these Ubuntu community docs for a short description and some instructions on setting it up.

1

I have successfully used freenx on Ubuntu using the Windows client from http://nomachine.com.

For me this was to allow me to use an old tablet PC (that struggled even with a clean install of Windows XP) as a front end into a more powerful Ubuntu desktop machine.

The only issue I had was that you needed to turn the "Visual Effects" to none to get decent performance.

I was going to comment on txwikinger's answer suggesting nxserver, but I don't have enough reputation.

1

Setting up for remote X access can be daunting, and involves multiple steps.

I use x2go, which is load-and-go, and exceptionally easy to use. It gives you a full desktop, just as if you had connected a new screen and keyboard to your server. It has full X functionality.

x2go is NOT a "remote desktop" solution. You get a completely new session. However, you can disconnect and reconnect from the same or different machine with the x2go client; your desktop is persistent. Best of all, the desktop on your client machine is completely scale-able in real-time simply by resizing the window.

x2go uses ssh for transport, so your data is encrypted. This simplifies traversing firewalls. Speed doesn't feel impacted by the use of ssh for transport.

x2go client software is available for Linux and Windows, and Mac.

Very nice free and open source software. I use it every day.

You must log in to answer this question.

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