I would like to run two X server instances at the same time.

One would be an interactive session using the mouse and keyboard attached to the computer. The other would be a 'virtual' session that I could then connect to and use over a network.

In other words, I want something like telnet/ssh that allows me to log in to my Ubuntu machine from somewhere else. However, I would like at least a basic graphics display when I log in.

  • 1
    Im assuming you want to run two users on your computer simultaneously?
    – richzilla
    Oct 26, 2010 at 20:37
  • @rich: Yes, but both should have a graphical display. Oct 26, 2010 at 21:03

6 Answers 6


If you are running an X session under Ubuntu on machine A it will appear on screen:0 (Ctrl+Alt+F7) on A.

You want to run a remote X Session from machine B (on your Lan) without interrupting your current session on A.

Go to the first console screen (Ctrl+Alt+F1) login at the console and then ask Machine B to send an X session to screen: on A - like this

u@A:~$  X :1 -query IP-of-B

X asks for an X session, :1 says to put it on screen 1, -query asks for the session from in this case IP address of B

You will find the new session on screen :1 (Ctrl+Alt+F8).

This is not secure (no ssh) but is quick and easy for a home network when sound is not required over the connection.

You can use nomachine's nxclient/server which is fine but runs in your current session on A screen :0 in its own window. It provides support for local sound and local printing - last time I looked Firefox would not start up if sound was enabled.

  • This definitely helps. Mar 28, 2011 at 1:29

ssh -X

The first and easiest option would certainly be "ssh -X", but this will only work when the system you connect from is already running an X server. So suppose you are running an Ubuntu machine and want to connect to another Ubuntu machine, you can type "ssh -X ipaddress" in the console. This will leave you with a console, but when you start any application that uses X from that console, it will be shown in your current X session.


If you would be running windows and want to start an X session on a remote Ubuntu machine, you can use XMing. XMing is basically an X server to run on windows. It is available on sourceforge.

To use XMing, XDMCP must be enabled on your Ubuntu machine. This was easily done in Ubuntu before 10.04. Nowadays, you have to update /etc/gdm/custom.conf as follows. Make sure to make a backup first! You don't want to mess up GDM with this ;)






  • +1 Thanks for explaining in detail how to do this - will other Linux distros running X be able to do the 'ssh -X' trick? For example, if I have a Fedora box, can I connect to my Ubuntu machine and run applications over X that way? (I'm grasping for the right terminology here, but failing :)) Oct 26, 2010 at 21:38
  • Just tried this and it works great. Oct 26, 2010 at 22:37
  • @George: Remember X is a little backwards. The user runs the server locally which the individual applications (the clients) connect to.
    – Roger Pate
    Oct 27, 2010 at 15:02
  • 1
    @George: As long as your Fedora box is running an X server, you will be able to use ssh -X. Basically ssh will make use of the X server on your Fedora box to show you the Ubuntu applications.
    – W. Goeman
    Oct 27, 2010 at 18:22

Not quite an answer to your question, but...

You can run X-programs over ssh, I often use this to give me access to protected/restricted services on my LAN when i'm out. Basicly what it does is connect a pipe from you machine to an ssh-server ans forward the display from the server to the client, but the application is running on the server. By default the SSH client isn't setup for this but it can be enabled by using the -X option. Ex:

ssh -X user@host firefox

Actually this is how LTSP works these days. You might be able to find more information on how LTSP is doing when remotely using a whole session instead of just a single app.


I actually discovered another way to achieve this: with xrdp Install xrdp.

xrdp is a Remote Desktop server for Linux that creates a separate login session (with X) that can be accessed with Windows' Remote Desktop tool or with other RDP compatible applications.


FreeNX will also serve your purpose.

From Ubuntu Wiki:

FreeNX is a system that allows you to access your desktop from another machine over the Internet. You can use this to login graphically to your desktop from a remote location. One example of its use would be to have a FreeNX server set up on your home computer, and graphically logging in to the home computer from your work computer, using a FreeNX client.computer, using a FreeNX client.



Sounds like you might be looking for a VNC server package. There are two kinds of VNC server packages-- the ones that share your existing X display, and the ones that manage a separate X desktop for remote use. The latter is the kind you seem to want. Examples include vnc4server and tightvncserver/tigervncserver.

Those packages allow you to start additional X displays in the background. To see them, you use a VNC viewer/client. There are multiple clients available for Ubuntu and Windows, not to mention Android, PalmOS, etc.

You must log in to answer this question.

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