Start New Remote X Session In Separate TTY

In my home setup, I have two computers on the same local network, both run Ubuntu 20.04. I'm hoping to set up a way to access my secondary computer via my primary, by switching to a new TTY, and starting a remote X session. I don't want to share the screen, or access an existing X session. Additionally, the computer I am using to start the remote X session has two monitors, and I would like to take advantage of both.

I have tried a couple of options. I seems like XDMCP could do what I want, but I have had little luck so far (getting access, but only a black screen with cursor). Additionally it seems like it both uses a high bandwidth and is insecure, so ideally I would use something else.

I have tried X2Go, but I have not been able to find a way to start it in a separate TTY, or to have it take advantage of both of my monitors.

I have heard also of things like xvnc, and NoMachine, but I'm not sure if either of those can be run the way I would like.

Is there any existing ways to do this? Or alternatively, any way to compress and/or secure XDMCP? I have seen it may be possible to have XDMCP go over SSH, is this true?

Thanks!


X window sessions don't work the way that you're expecting them to work. You're thinking that there is a "server" on the other side that you're connecting to, and that you want to control.

In reality, it works the opposite. The machine that you're connecting from acts as the server, and when you connect, you tell it to display on a different machine.

So, X needs to be running on the machine that you're connecting FROM, then do the following:

  • Open an xterm, or whatever your favorite terminal window app is.

  • On the local machine, in the terminal, allow connections from the remote host:

    xhost + 192.168.1.2 (where 192.168.1.2 is the machine you are connecting to)

  • In the same terminal, open a shell to the remote machine (192.168.1.2), using ssh, with X11 forwarding:

    ssh -Y login@hostname

  • On the remote machine, set your display:

    export DISPLAY=192.168.1.1:0.0
    (this will be the machine that you are connecting from)

  • Now start a program. Just run xeyes, or xcalc, or chrome, or whatever. The program should show up on your local X Window interface, after a while. It's running on the remote machine, but displaying locally.

Note that the remote machine doesn't even need to have an X Window server running on it. It's actually acting as the client, to your local computer's X Window server.

XDMCP is definitely "heavier" than a more optimized protocol for display changes, like VNC. Then again, the goal is different: VNC usually operates on the entire screen. And there's nothing to stop you from installing a VNC server, and going that route. In that case, any VNC client would work.