VNC (Virtual Network Computing)
What is VNC and how does it work?
VNC (Virtual Network Computing) is a technology that allows you to control a remote computer over a network, typically the internet, as if you were physically sitting in front of it. It enables remote desktop sharing and control (You can think of it as something similar to Team Viewer or Any Desk Apps). Here's a simplified explanation of how VNC works:
There are different implementations and variations of VNC, such as TightVNC, RealVNC, X11VNC, Tiger VNC and UltraVNC, each with its own features and capabilities.
It's important to note that while VNC provides remote access and control, security considerations are crucial. Using strong passwords, encryption, and configuring firewalls properly is essential to protect the remote computer and data during VNC sessions, especially when accessing remote computers over the internet.
Installing VNC Server on remote computer and login to it!
Enough theory? let's try to make things more interesting by demonstrating how you can control remote computer using VNC.
In my case, I want to control remote computer (Ubuntu Desktop LTS 22.0) running somewhere in the cloud from my windows 11 laptop. So I need to do the following:
sudo apt-get update
// (This is to update our references)
sudo apt-get install lightdm
// (This changes the display manager)
sudo reboot
sudo apt-get install x11vnc
sudo nano /lib/systemd/system/x11vnc.service
//let's configure the service, copy and paste the code below and change the "password" to your own password:
[Unit]
Description=x11vnc service
After=display-manager.service network.target syslog.target
[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -forever -display :0 -auth guess -passwd password
ExecStop=/usr/bin/killall x11vnc
Restart=on-failure
[Install]
WantedBy=multi-user.target
//CTRL+O to save , then CTRL+X to exit
sudo systemctl daemon reload
//restart the service
sudo systemctl enable x11vnc.service
//enable the x11vnc service
sudo systemctl start x11vnc.service
//start the VNC Server service "x11vnc.service"
sudo systemctl status x11vnc.service
//to check if the VNC server service has been started, you should see an output saying that service is active (running), then CTRL+C to back to CLI
typically, you need to disable screen lock for the remote computer you are trying to manage, because if the screen lock is enabled, after defined period of time this will lock the screen and might causing issues for the VNC when you try to connect to it.
领英推荐
your application window will be empty with no hosts added if this is your first time using Real VNC viewer, but in a moment, we are going to your first machine.
Click on File, then New connection, and you will have the following window open:
Type the IP address of your remote machine, of course you must have connectivity to the remote host over the internet, LAN, or VPN. and give it friendly name so you can remember 1 year later what this host was xD.
you will be prompted to enter the password, remember this is the password you set earlier in step 1 above when configuring the x11vnc.service file!
Few important note!
by default, in Ubuntu Desktop LTS 22.04 version, UFW (Uncomplicated Firewall) is off, but there is no harm in double checking that if you find yourself troubleshooting the connection and make rule to allow traffic destined to port 5900 or whatever port is being used by your VNC server.
So, this is it, I hope this helped you and see you in another article.
Glad to see more people are using Ubuntu nowadays!
IP Network | 2X CCNP SP & EI | NSE4 | MTCRE-MTCNA @ X company
1 年actually useful article for network engineers ??