Get a remote X connection to work

Q I got into Linux many years ago after installing Red Hat 5.1 on my Amiga 4000. While managing to get to grips with it fairly well, I have never succeeded in getting a remote X session to work. I can log in via SSH and use the shell, but I really want to access my remote machine with X. My remote machine runs MythTV on Kubuntu, and the one I want to access it from is running Gentoo. I only want to access the desktop for simple administration tasks (not viewing MythTV), so it shouldn't be impossible, but I've got so confused as to which is considered client and server or remote and host that I'm lost! I'm using AMD64 and some don't seem to like it.

A I too started using Linux on an Amiga 4000 (with Red Hat 4.5) things were nowhere near as easy back then as they are now. Remote X access is relatively straightforward, and useful with MythTV because the mythtv-setup program can run on a remote back-end but opens an X window. The client-server thing can be confusing with X if you are used to the web model of considering the remote machine to be the server and your desktop computer the client.

The X server is the program responsible for creating the X display, so it runs on the local machine. The clients are the programs running on that display. So your Gentoo desktop is the server and the programs on the MythTV box are the clients. Running anX program on a remote server over SSH is straightforward and works with the default SSH settings in Gentoo and Kubuntu. SSH into your Kubuntu machine from your Gentoo box with the -Y option. You can then run X programs and make them open their windows on your Gentoo desktop. For example, doing

[user@gentoo]$ ssh -Y kubuntu
user@kubuntu's password:
[user@kubuntu]$ mythtv-setup

will run the mythtv-setup program from the Kubuntu box on your Gentoo desktop. You may occasionally find that you cannot log out of the SSH session after running an X program. This can be caused by the program having started other processes that are still running; for example, KMail opens a couple of communication sockets. Run ps in another SSH session to identify these, then kill them and you will get your prompt back.

The other applications you refer to are probably desktop-sharing programs, which mirror or open an X desktop on a remote machine. These require X to be at least installed on the remote computer, and in the case of programs that mirror it, the desktop must be running. As you are using KDE, the simplest of these is KDE's own krfb and krdc. The former is a server, run on the remote computer and configured in the KDE Control Centre. The latter is run on the local box to show the other computer's desktop in a window. Both are installed by default in Kubuntu; you will need to emerge kde-base/krdc on your Gentoo system. VNC works differently by opening a desktop screen specifically for the remote display, separate from any local desktop screen running.

Follow us on Identi.ca or Twitter

Username:   Password:
Create Account | About TuxRadar