A remote desktop lets you control your computer from wherever you are, which is super handy for working or fixing issues. For users of Ubuntu, TightVNC Server is one such stand-alone option to opt for. This software uses VNC to remotely view and control your computer's screen.
This tutorial covers the TightVNC Server installation on Ubuntu. We'll guide you through installation and show you how to secure your connection.
TightVNC is a remote desktop application built on the VNC protocol. With this tool, you can control and view your Linux computer on a different machine, whether it is a laptop or a mobile. This software also compresses data and optimizes bandwidth, so it is extremely beneficial for low latency, low-speed internet. This software is used quite frequently by developers and administrators to access servers from far away and to debug everything.
TightVNC possesses some great benefits to Ubuntu users:
Resource-Efficient: Since it does not require a lot in terms of resources, it is appropriate for low-power PCs and works well on old computers.
Multi-Platform Compatibility: It is compatible with other operating systems thus you can use your setup from various devices, e.g., tablets, windows computers, and even Macs.
Customizable Configurations: You can customize the tool to your needs. You can utilize your own ports, use secure tunnels for the sake of security, or use less technical desktop environments so that all the things remain light and fast.
Cost-Free Solution: It's an open-source project, so the software is completely free for both business and personal use.
Ensure you have:
Initially, upgrade your system so that all processes work perfectly and there are no issues during the installation. Run:
sudo apt update && sudo apt upgrade -y
The command updates outdated programs and also puts the list of software on your computer in a refreshable state.
Now, install the TightVNC server package using the following command to enable the remote desktop functionality.
sudo apt install tightvncserver -y
This installs the core software. The -y
flag automatically confirms the installation prompt, ensuring the process is uninterrupted.
Once completed, the application will be ready for further configuration.
TightVNC requires a GDE and LXDE is recommended due to its lightweight nature:
sudo apt install lxde -y
By restricting the utilization of resources, LXDE provides your system with more space for your real work. It is particularly useful if your server is low in RAM and CPU.
Configuration is crucial in installing the tool to your specifications. To ensure proper operation, do the following:
Run TightVNC server to create your initial session:
tightvncserver
It will ask you to create a remote access password during initialization. This password guarantees only approved users may connect.
To modify default settings, first stop the server:
tightvncserver -kill :1
Stopping session :1
allows you to edit the startup file without interruption.
Create or modify the startup file:
nano ~/.vnc/xstartup
Add the below-provided configuration:
xrdb $HOME/ .Xresources
xsetroot -solid grey
export XXL_XMODMAP_DISABLE=1
/etc/X11/Xsession
/usr/bin/startlxde
These commands start an X11
session with a graphical desktop. They start user configuration, set the background color, disable custom keyboard mappings, initalize the session, and start the LXDE environment.
Then assign the correct permissions to ensure it executes properly:
sudo chmod 755 ~/.vnc/xstartup
Restart the server to ensure correct configurations are applied:
tightvncserver
The session number (e.g., :1) displayed in the output allows for remote connection.
Now it’s time to connect to your server using the TightVNC Viewer or any compatible VNC client.
First, get your server’s IP address using:
hostname -I
Then use the below instructions:
192.168.X.X:590X
.Once connected, the graphical interface is remotely manageable.
Remote access involves potential security risks, so it’s important to secure your server connection.
To encrypt your connection, create an SSH tunnel:
ssh -L 5901:localhost:5901 user@your_server_ip
Replace user and your_server_ip
with your server details. Access the VNC session via localhost:5901
in the VNC Viewer.
Use the system firewall to allow connections only from trusted IPs:
sudo ufw allow from your_trusted_ip to any port 5901
Replace your_trusted_ip
with the IP of your local machine.
You can stop a session to save resources when it’s not needed:
tightvncserver -kill :1
This disables the active connection without uninstalling the server.
If you encounter problems during setup or remote access, these solutions may help:
If TightVNC only shows a blank or gray screen, try these solutions:
Kill all VNC sessions: Conflicting sessions can cause display issues.
tightvncserver -kill :session_number
Once done, run the server again:
tightvncserver
Restart the System: A simple reboot can resolve graphical glitches and session conflicts:
sudo reboot
Specify the Display Screen: Ensure the correct display screen is used by setting the DISPLAY variable:
export DISPLAY=:1
This will allow remote access to the login screen via Xorg. Also, don’t forget to include startxfce4
in the xstartup
file.
Remove Lock Files: Leftover lock files can interfere with graphical sessions:
sudo rm -rf /tmp/.X*-lock /tmp/.X11-unix/X*
Confirm the port (e.g., 5901) is open:
sudo ufw status
Open the port if necessary:
sudo ufw allow 5901/tcp
Check for logs in the .vnc
directory:
cat ~/.vnc/*.log
Some VNC servers might only listen on localhost by default. To fix the issue, run:
vncserver -localhost no
You can expand the application usability by integrating it with cloud services for remote accessibility. Apply the following instructions:
Open ports required for TightVNC through the cloud platform’s security group settings (e.g., port 5901 for VNC sessions).
Use SSH tunneling to secure access:
ssh -i your-key.pem -L 5901:localhost:5901 user@cloud_server_ip
Overlooked client settings can really boost usability and security.
In case someone needs to monitor activity without interacting with the desktop:
Set a view-only password:
tightvncpasswd -viewonly
Provide the user with the view-only password while keeping control of the main session.
Automation can streamline workflows for repetitive tasks or multi-session setups.
Write a script to launch multiple VNC instances simultaneously:
nano ~/start-vnc-sessions.sh
Add:
#!/bin/bash
tightvncserver :1
tightvncserver :2
tightvncserver :3
Make the script executable:
chmod +x ~/start-vnc-sessions.sh
Run the script:
./start-vnc-sessions.sh
TightVNC Server installation on Ubuntu allows secure remote desktop access with maximum accessibility and productivity. This tutorial has given you an optimized and secured environment through which you can remotely access your system. For remote access for troubleshooting purposes, server management, and so on, TightVNC offers simple management with maximum resource utilization.