How I access Ubuntu GUI remotely using VNC
How do I set up VNC on Ubuntu machine so I could use let's say VNC client like TightVNC Viewer on Windows 11 to access Ubuntu Gnome Interface remotely? Here's how!
1) On Ubuntu machine do: sudo apt-get install x11vnc
2) As a regular user that is dedicated to run VNC server, do: x11vnc -storepasswd
3) To allow VNC server to start at every boot do: sudo nano /etc/systemd/system/x11vnc.service
a) Paste the following text into the x11vnc.service file:
[Unit] Description=Start x11vnc at startup After=multi-user.target [Service] Type=simple ExecStart=/usr/bin/x11vnc -forever -usepw -display :0 Restart=on-failure RestartSec=10 [Install] WantedBy=multi-user.target
4) Save the file
5) Opening up port in UFW (firewall) by doing: sudo ufw allow 5900/tcp
6) Add an existing user to group of video so this user could be dedicated as a user could run VNC server: sudo usermod -aG video username
a) Remember to replace username in the command above with an existing username on your system.
7) Reopening up the x11vnc.service file with nano and in [Service] section, entering this:
[Service] ... User=username Environment=HOME=/home/username ...
a) Remember to remove the ... lines above as it's just representing a shorthand for telling you that the omit section of [Service] is still valid but not written here.
b) Remember to replace the username with the existing user we configure to run VNC server Ubuntu service above.
8) Do this inside Ubuntu server: sudo systemctl daemon-reload
9) Do this inside Ubuntu server: sudo systemctl start x11vnc.service
10) Now go to Download TightVNC and starting to download the right VNC client version of TightVNC for your Windows 11.
11) Installing the TightVNC client as how you would do with any other Windows 11 software.
12) Make sure you enter a password for TightVNC client so it protects your VNC client from unprotected access issues.
By the way, I used Chat GPT to help me with the tasks above.