There are a variety of methods.
The usual method is to use ssh to connect to the remote machine. Often this just means getting a shell in a terminal, but you can also forward network traffic over the ssh session in a secure way. This is often used to "tunnel" an X-session over ssh.
For individual programs, it goes something like this:
- Make sure the machine which you want to remote connect to is running sshd (the server part of ssh), and it is configured to allow X11 forwarding.
- From your client machine (which is running Linux of course, or at least something with ssh and an X server), connect to the remote host. You need to enable X11 forwarding using the -X option:
ssh -X firstname.lastname@example.org
- You will get a shell on the remote host. Because you used the -X option, you should have the DISPLAY set to send X programs back through the ssh tunnel. Try it, run an X program, e.g. xterm. If it appears on your local display, you've done it right.
There are some limitations of this approach. Firstly, X over the network is not super efficient. It will probably be pretty slow.
Secondly, you are not getting the whole session - just individual programs.
The X-way of doing a whole session is to start your local X-server and let it connect to a remote machine. For this you need to configure your graphical login manager (GDM for gnome, KDM for KDE) to allow remote logins with X.
There are config options for this. A common way to do it is like this:
- Configure GDM or KDM on the remote machine (whichever you are running) to allow remote logins.
- On the local machine run something like Xephyr like this:
Xephyr -once -screen 1024x768 -query remotehost.com :1
The problem with this is that it is not secure, so unless you are on a trusted network, you need to do it via an ssh tunnel.
The last method, which has the advantage of letting you connect to your Windows machines as well as your Linux machines, is to use the remote desktop protocol.
I am not sure about centOS, but I know lots of distros come with gnome pre-configured to have a remote desktop server running in a systray applet. I think this is a standard component of gnome, you just have to enable it in the config. I think it's called vino - install that if it not installed already.