Securely Connect to your Rocky Linux Cloud Server over VNC

Updated on March 1, 2022
Securely Connect to your Rocky Linux Cloud Server over VNC header image


VNC (Virtual Networking Computing) is a system to access computing systems remotely by sharing graphical desktop environments.


Install Dependencies

  1. Install Gnome.

     $ sudo yum groupinstall "Gnome"
  2. 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.

  1. Setup VNC user password.

     $ vncpasswd
  2. Edit vncserver.users.

     $ sudo nano /etc/tigervnc/vncserver.users
  3. At the bottom of the file, add a new VNC user. Replace user with your VNC user.

  4. Copy VNC server service boilerplate.

     $ sudo cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
  5. Allow the server to run at startup.

     $ sudo systemctl enable vncserver@:1
  6. Start the VNC server.

     $ sudo systemctl start vncserver@:1
  7. Verify VNC server is running.

     $ sudo systemctl status vncserver@:1
     Active: active (running)

Server Connection

  1. Initiate SSH tunneled connection on the client machine.

     $ ssh -L 5901:localhost:5901 -4

    > Use the flag -4 if your server only has an ipv4 address.

  2. Using a VNC viewer of your choice, enter the following server address:

  3. 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.

  1. If it doesn't already exist, create and edit the config file.

     $ nano ~/.vnc/config
  2. Arguments are line-separated and use an equal sign for values. Here's a sample config file:

  3. Restart the VNC server to apply changes.

     $ sudo systemctl restart vncserver@:1


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.