This step of the process is the most important. You'll need to define the user you'll want to use that'll actually run the service. Now ensure you're logged into the user and make sure it isn't root.
Enter a 8 digit password, if you enter anything more it'll truncate anything above 8. Now you need to kill the process created in order to then setup a functional systemd file, To note if you have another vncserver instance already you'll need to ensure you kill the right one. When you setup the VNC password it'll output what instance it's running on and will look something similar to :1 or :2 etc.
vncserver -kill :1
Run the following:
Delete the existing file contents then paste in:
Save the above then enter:
chmod +x ~/.vnc/xstartup
Now exit back into the root user. You've just entered the parameters required for the vncserver to reliably operate via the xfce4 desktop environment. The next stage is ensuring it runs on startup via the systemmd service & to allow you to stop, start and restart the service in case something happens. The initial port of 5901 will be used here if you wish to do 5902, 5903 etc you'll need to put the last digit into the file name after the @ symbol. In this example, it'll use port 5901.
nano /etc/systemd/system/[email protected]
Description=Start TightVNC server at startup
ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 -localhost :%i
ExecStop=/usr/bin/vncserver -kill :%i
You'll notice the -localhost is in red, if you wish to enforce the VNC to localhost (highly recommended) you should leave this in, I'll cover how to use this to your advantage later. Now save and exit nano then:
systemctl enable [email protected]
systemctl start [email protected]
The service has now been started and is based on the systemd file you just created.