How to run two X sessions at the same time?

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.


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.

XMing

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

[daemon]
User=gdm
Group=gdm


[security]
DisallowTCP=true

[xdmcp]
Enable=true
DisplaysPerHost=2
HonorIndirect=false
MaxPending=4
MaxSessions=16
MaxWait=30
MaxWaitIndirect=30
PingIntervalSeconds=60
Port=177

[greeter]

[chooser]
Multicast=false

[debug]
Enable=false 

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.