To stop VNC desktop 1 execute: $ sudo service stop To start VNC desktop 1 enter: $ sudo service start Next, reload the Systemd: $ sudo systemctl daemon-reload PIDFile=/home/ linuxconfig/.vnc/%H:%i.pid Optionally, change screen resolution settings and apply other vncserver options or arguments: ĭescription=Systemd VNC server startup script for Ubuntu 18.04ĮxecStartPre=-/usr/bin/vncserver -kill :%i &> /dev/nullĮxecStart=/usr/bin/vncserver -depth 24 -geometry 800圆00 :%i
nano: $ sudo nano you have the file opened insert the following lines while replacing the linuxconfig username with username of your VNC user on Line 7 and Line 10.
VNC CONNECT TO GNOME UBUNTU HOW TO
If you wish to make your firewall rules more strict or allow range of ports for multiple VNC sessions visit our How to Open/Allow incoming firewall port guide for more information.Īlthough the current configuration works, one might want to setup a systemd startup script in order to easily manage multiple VNC desktop sessions.Ĭreate a new file using your favorite text editor eg. In case you have the UFW firewall enabled, open the port 5901 for incoming connections or see below how to tunnel the VNC connections via the SSH protocol: $ sudo ufw allow from any to any port 5901 proto tcp State Recv-Q Send-Q Local Address:Port Peer Address:Port Your Ubuntu system should now be listening on the port 5901 for incoming VNC connections: $ ss -ltn The VNC server will open a new port for every new VNC desktop you create. Log file is /home/linuxconfig/.vnc/ubuntu:1.log Starting applications specified in /home/linuxconfig/.vnc/xstartup New 'ubuntu:1 (linuxconfig)' desktop is ubuntu:1 For this simply run the vncserver command from your home directory: $ vnc4server Lastly, make the ~/.vnc/xstartup file executable: $ chmod +x ~/.vnc/xstartupĪt this stage we are ready to start the VNC server. Insert the the following content and save: #!/bin/bash Next, create the ~/.vnc/xstartup file to start the Xfce4 desktop: $ mkdir ~/.vnc Once the VNC server is installed we can begin the configuration by setting up a user password to be used by a VNC client when creating a remote connection: $ vncpasswd
VNC CONNECT TO GNOME UBUNTU INSTALL
Let’s start by the installation of the VNC server and the Xfce desktop manager core files: $ sudo apt install vnc4server xfce4 xfce4-goodies Ubuntu 20.04 (Focal Fossa) Instructions Ubuntu VNC server setup
Privileged access to your Ubuntu System as root or via sudo command is required. Operating System: – Ubuntu 18.04 Bionic Beaver.The objective is to setup VNC server on Ubuntu 18.04 Bionic Beaver Linux.