One issue I’ve found written about on forums (without resolution) and experienced with much frustration is getting remote desktop via VNC to work on Fedora 24 server and newer. It seems like something has changed in the matrix and running the standard setup for vnc server on Fedora that worked on Fedora 19/20/21/22/23.. just doesn’t seem to work. Now as curious as I am, I’m not going to go install a VM of any of those versions of Fedora and track down the minutia of differences. What I will describe though is how to get it to work.
If you’ve been trying this and can’t seem to get it to work, the problem may lie on the TigerVNC viewer for Windows. For me the Windows VNC client keeps connecting properly but the screen is always blank. I noticed the vncserver instances that I started on my Fedora server were all 24 bit and the Windows TigerVNC viewer kept “connecting” to 32 bit sessions. What did work for me was switching to RealVNC viewer, the connection worked perfectly on my local server.
The step by step instructions are as follows:
For connecting via a Windows client to a Fedora 24 and newer server.
For the client side you should install RealVNC viewer. Make sure you don’t have any firewall or anti-virus software that may block the connection. Often times I’ll remove all security settings when doing the intial setup, and then go back and re-enable security settings and open ports as necessary. Sometimes knowing the connection is working, is half the battle.
Install TigerVNC server:
dnf install tigervnc-server
Create a user which will run the VNC server services, for this example lets use user vncremote:
Now we’ll need to create a strong password for this user.
If we #cat the setup template located at /lib/systemd/system/vncserver@.service we can find the next steps.
It reads as follows.
# Quick HowTo:
# 1. Copy this file to /etc/systemd/system/vncserver@.service
# 2. Replace with the actual user name and edit vncserver
# parameters appropriately
# (“User=” and “/home//.vnc/%H%i.pid”)
# 3. Run `systemctl daemon-reload`
# 4. Run `systemctl enable vncserver@:.service`
I read that you should rename the file vncserver@\:.service
So after editing my file located in /etc/systemd/system/vncserver@\:.service looks like this:
Description=Remote desktop service (VNC)
ExecStart=/sbin/runuser -l vncremote -c “/usr/bin/vncserver :1 -geometry 1280×1024 -depth 24”
ExecStop=/usr/bin/vncserver -kill :1
# Clean any existing files in /tmp/.X11-unix environment
#ExecStartPre=-/usr/bin/vncserver -kill %i
ExecStop=-/usr/bin/vncserver -kill %i
Now we will reload systemd
Let’s login to the use vncremote to set the VNC server password.
su - vncremote
Run the following,
and enter a strong password.
Before we start an instance of VNC server, I would recommend having a desktop environment like MATE installed. Outside MATE just being a great desktop, the lower system requirements and lower graphical requirements make it a better option for remote GUI connections. Simply put it will be a smoother more user friendly connection if you use MATE. In order to use an alternate desktop environment we need to edit the /home/vncremote/.vnc/xstartup file.
My file, /home/vncremote/.vnc/xstartup now looks like this:
OK, now lets start VNC server.
sudo vncserver :2 -geometry 1280x1024 -depth 24
I used vncserver #2, just for example sake, you can use any x session. This server will use port 590#, # representing the xsession we chose. So in our case our port would be 5902.
If you start up the Windows RealVNC client we can enter our servers IP address and port number to connect.
There you have it, you are now working remotely!!
If you would like to check the services running under your user, run the command:
From these results you can kill old instances and track new ones.