How to use VNC Server?

BTb4...tBoy
3 Jan 2024
38

If you have a server, you can setup a vncserver and use it with remote. First of all, we should know what VNC is.

What is VNC ?


Virtual Network Computing (VNC) is a graphical desktop sharing system that uses the Remote Frame Buffer protocol (RFB) to remotely control another computer. It transmits the keyboard and mouse input from one computer to another, relaying the graphical-screen updates, over a network.*

*This expression is got from Medium in this article.

Step 1


First connect your server with ssh and update

 sudo apt update 


Install Xfce which is require for desktop envirenment.

sudo apt install xfce4 xfce4-goodies


When it is done, install TightVNC Server.

sudo apt install tightvncserver


Run vncserver and setup a password between 6 and 8 characters.

vncserver


Step 2


We will configure VNC Server. First kill the process by entering

 vncserver -kill :1  


We will modify the file.

 mv ~/.vnc/xstartup ~/.vnc/xstartup.bak  
 nano ~/.vnc/xstartup  


Add this to you xstartup file and exit with save pressing ctrl+x y enter.

 #!/bin/bash
xrdb $HOME/.Xresources
startxfce4 &  


Make the file executable and restart the vncserver

 chmod +x ~/.vnc/xstartup  
 vncserver -localhost  



Steps 3


Create a ssl connection to your server.

 ssh -L 59000:localhost:5901 -C -N -l 'user' 'your_ip' 


Now you are going to open your VNC Viewer and login localhost:59000. I used TigerVNC Viewer on my mac. Enter your password and you will see the desktop of your server through your VNC Viewer.




Write & Read to Earn with BULB

Learn More

Enjoy this blog? Subscribe to thertln

3 Comments

B
No comments yet.
Most relevant comments are displayed, so some may have been filtered out.