In this tutorial we shall setup VNC such that we can remotely access a Linux desktop (Ubuntu 20.04) from a Windows 10 laptop. The Ubuntu desktop hosts the VNC server, whereas the Windows machine hosts the client.
Ref :
- https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-on-ubuntu-20-04
- https://www.linuxtopia.org/HowToGuides/VNC_setup_Linux_Windows.html
sudo apt update
sudo apt install xfce4 xfce4-goodies
During installation, you may be prompted to choose a default display manager for Xfce. A display manager is a program that allows you to select and log in to a desktop environment through a graphical interface. You’ll only be using Xfce when you connect with a VNC client, and in these Xfce sessions you’ll already be logged in as your non-root Ubuntu user. So for the purposes of this tutorial, your choice of display manager isn’t pertinent. Select either one and press ENTER. I chosegdm
(the default).sudo apt install tightvncserver
vncserver
You’ll be prompted to enter and verify a password to access your machine remotely. NOTE: Note that if you ever want to change your password or add a view-only password, you can do so with thevncpasswd
command.- Because you are going to be changing how the VNC server is configured, first stop the VNC server instance that is running on port 5901 with the following command
vncserver -kill :1
- Backup the original startup hook (script) before edits :
mv ~/.vnc/xstartup ~/.vnc/xstartup.original
- Create a new startup hook
~/.vnc/xstartup
containing only the following
#!/bin/bash
xrdb $HOME/.Xresources
startxfce4 &
chmod +x ~/.vnc/xstartup
- Restart the server :
vncserver -localhost
This properly sets up a VNC server listening on port 5901 at the Ubuntu machine.
Forward port 5901 of the Windows machine (client) to port 5901 of the Ubuntu server using tunnel, ipns-link or ssh -L
.
- At the Windows 10 laptop, download and install tightvnc.
- We don't need the VNCserver here. So in the
System Tray
, right-click Tightvnc and shutdown the server. - Open the
TightVNC Viewer
app (search atWin+s
). This opens a dialog box. - At the
Remote Host
field either writelocalhost:1
orlocalhost:5901
. ClickConnect
. - When prompted for the password, enter the password you have setup your VNCserver @ Ubuntu with.
- To open Terminal in
xfce
, open program launcher by using :Alt+F2
. Then typeXfce Terminal
and launch.