My favorite method for remote connections is to use vino. It's similar to x11vnc, but I find it much easier to set up (though I'm typically using a GUI). With Vino enabled, gnome is set up to accept vnc connections for the active session (the one that is currently logged in), for every boot. Any windows or applications open on the screen will be viewable in the vnc connection.
In normal cases (e.g., through a GUI), it's enough to set it up by running
$ vino-preferences
In the absence of a GUI, the settings must be changed using gsettings
. Something like
$ gsettings set org.gnome.Vino enabled true
$ gsettings set org.gnome.Vino view-only true
$ gsettings set org.gnome.Vino authentication-methods "['vnc']"
$ gsettings set org.gnome.Vino prompt-enabled false
$ gsettings set org.gnome.Vino require-encryption true
would enable remote desktop with sane values. You can see the full list of options as well as a description of their effects by opening dconf-editor
and navigating to desktop.gnome.remote-access
.
If your computer has multiple users, Vino will need to be set up for each user.
To connect to your remote session, you can use any standard vnc client. However, you must forward port 5900 to the computer you want to connect to from your router's firmware. Alternatively, if you are also allowing for ssh connections to these computers, it may be easier and more secure to use vnc through an ssh tunnel. From your local machine:
ssh -L 5900:localhost:5900 <remote server>
Then open up a vnc client and connect to 127.0.0.1:5900 and log in with your remote server's username and password.