
When you deploy an Ubuntu server at Vultr, you'll need to perform system administration using the command line. In addition, sometimes, you'll want to install a Graphical User Environment (GUI) to use the cloud server as an Ubuntu desktop.
This guide describes how to install the XFCE GUI and connect to it securely with Virtual Network Computing (VNC). After installing, you'll have a desktop similar to the Xubuntu distribution.
VNC is a desktop sharing system that allows you to remotely control another computer when you use Vultr cloud computing hosting.
Cloud computing is the delivery of servers, storage, databases, and networking over the Internet (a.k.a. "cloud"). You only pay cloud services you use, with no up-font purchase required.
Deploy a new Ubuntu 20.04 server at Vultr.
Connect to the Ubuntu server as root.
Update all packages.
Because it's not secure to connect to the GUI as root, create a new user with sudo access. Replace example_user with your desired username. Enter a strong user password when prompted. Then, fill in the other information as desired.
Add the new user to the sudo group.
VNC listens on port 5901 by default, and the connection is not encrypted.
One option for security is to block the VNC port in the server firewall and tunnel the connection via SSH. If you choose that option, please set up the firewall name before installing VNC.
These commands block all connections except SSH.
If you already have custom firewall rules and only need to add protections for VNC, run the following command to block port 5901.
With port 5901 blocked, you'll need to set up an SSH tunnel. See step 6 in this guide for more details.
If you want to avoid the extra complexity of the SSH tunnel described in step 6, you could protect the server with the Vultr Firewall, blocking all traffic to port 5901 except your IP address. See the Vultr Firewall Quickstart Guide for more information.
Install XFCE, TightVNC server, and Firefox web browser.
Choose gdm3 when prompted by the installer.
Change to the new user account for the rest of this guide. Do not run these steps as root.
Run VNC to set up the configuration.
Enter a password for VNC connections. VNC uses a maximum of 8 characters and automatically truncates longer passwords.
When asked to enter a view-only password, choose N.
Example output:
Stop the VNC server.
Make a backup of the default startup script.
Edit the startup script.
Add the following line to the end:
Save and exit the file.
Create a new systemd service file.
Paste the following service script in nano. example_user appears in two places. Change those entries to the sudo user name you created.
Save and exit the file.
Reload the systemd services and start VNC. You'll be prompted for your password.
Enable the service to start at boot. You'll be prompted for your password three times as the system makes the updates.
Reboot the system.
VNC is listening on port 5901, and it's blocked in the OS firewall or with the Vultr Firewall if you've followed this guide.
This method works on any platform that has a command-line SSH client.
Open a terminal on your local workstation.
Run this command on your local machine, not the server.
Enter your SSH login password.
If you use SSH keys, you could also include the `-i' parameter and path to your key, like this:
With the tunnel established, connect to your remote GUI at 127.0.0.1:5901. Then, see step 7, Connect with a VNC Client below.
PuTTY is a popular terminal program for Windows, and it can also forward ports over SSH tunnels.
Open PuTTY to create a new connection.
Navigate to the Session category.
Enter the server's IP address and select port 22, SSH connection type.
Navigate to Connection -> SSH -> Auth -> Tunnels.
Enter 5901 in Source Port and your server's IP address followed by :5901 in Destination.
Click Add.
The port forwarding information will appear in the Forward ports list.
Click Open to establish the tunnel.
Your choice of VNC client depends on your platform and personal preferences; there are many options available.
Linux users have many options; see the Ubuntu Wiki for a list or popular options.
Windows users might choose TightVNC as a popular option, and there are many other clients available.
Mac users can use the built-in macOS Screen Sharing.app, or several commercial options. You can also launch it from the terminal:
There are many other VNC compatible options available online. Configuring the client is beyond the scope of this article, but in general terms:
127.0.0.1 (the local loopback) and port 5901. Your SSH tunnel will securely forward the connection from the local host to the remote server.5901.
0 Comments
Be the first to comment and share your perspective with the community.