Problem: You want to log in to a Gnome desktop on a remote Ubuntu 20.04 host.
Complication: You can only reach the host via SSH.
Further complication: A bug in Gnome currently makes it impossible to enable Gnome’s built-in screen sharing if you connect via SSH. ☹
Solution: Use TigerVNC and an SSH tunnel, and log into that desktop! Here’s how, minus the 2+ hours of head-scratching and swearing that accompanied my long trip down this short path today.
Caveats: This solution assumes you already have Gnome installed and working on the target host. It also assumes X11 provides the desktop on the host; if you’re using Wayland, these steps won’t work.
Step 1. Begin by SSHing to the remote host. Once you’re in, sudo apt install tigervnc-standalone-server to install TigerVNC.
Step 2. Run vncpasswd to set a password for your VNC sessions.
Step 3. Create a file at ~/.vnc/xstartup and fill it …