I recently followed a guide I found here: How to Install VNC Server on RHEL 8 to create a VNC session for a given user. I have since created a new user account: engineer and updated the systemd service file to point to the new user account as shown below:
[engineer@localhost ~]$ cat /etc/systemd/system/[email protected]
[Unit]
Description=Remote Desktop Service (VNC)
After=syslog.target network.target
[Service]
Type=forking
WorkingDirectory=/home/engineer
User=engineer
Group=engineer
PIDFile=/home/engineer/.vnc/%H%i.pid
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/bin/vncserver -autokill %i
ExecStop=/usr/bin/vncserver -kill %i
[Install]
WantedBy=multi-user.target
I created a new vnc password for the engineer account and then executed the systemctl daemon-reload command after creating my service file, then executed the command: systemctl start vncserver@:1 as per the guide and now I get the follow error message:
Failed to import environment: Process org.freedesktop.systemd1 exited with status 1
Annoyingly everything was working fine until updated the vncserver@ service file.
Interestingly if I revert all the settings in the service file back to the original user it works without fail.