Securely Connect to your Rocky Linux Cloud Server over VNC
Overview
VNC (Virtual Networking Computing) is a system to access computing systems remotely by sharing graphical desktop environments.
Prerequisites
- Deploy a new Rocky Linux 8 Vultr cloud server.
- Set up a non-root user with sudo privileges.
- Verify that your server is up to date.
Install Dependencies
Install Gnome.
$ sudo yum groupinstall "Gnome"
Install TigerVNC.
$ sudo yum install tigervnc-server
Setup VNC Server
If you want to set up a restricted session for a user, type "y" during the view-only password option. Clients who authenticate with the view-only password will have restricted mouse and keyboard access.
Setup VNC user password.
$ vncpasswd
Edit
vncserver.users
.$ sudo nano /etc/tigervnc/vncserver.users
At the bottom of the file, add a new VNC user. Replace
user
with your VNC user.:1=user
Copy VNC server service boilerplate.
$ sudo cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
Allow the server to run at startup.
$ sudo systemctl enable vncserver@:1
Start the VNC server.
$ sudo systemctl start vncserver@:1
Verify VNC server is running.
$ sudo systemctl status vncserver@:1 Active: active (running)
Server Connection
Initiate SSH tunneled connection on the client machine.
$ ssh -L 5901:localhost:5901 10.32.31.128 -4
> Use the flag
-4
if your server only has an ipv4 address.Using a VNC viewer of your choice, enter the following server address:
localhost:5901
After entering VNC authentication credentials, you should be presented with a Gnome desktop environment.
Additional Configuration
VNC server configurations can be set through the $HOME/.vnc/config
file.
If it doesn't already exist, create and edit the
config
file.$ nano ~/.vnc/config
Arguments are line-separated and use an equal sign for values. Here's a sample config file:
geometry=800x600 depth=24
Restart the VNC server to apply changes.
$ sudo systemctl restart vncserver@:1
Conclusion
You should have a working secure VNC connection to your Rocky Linux Cloud Server. For more info, refer to the official TigerVNC website for documentation.