I've a RHEL 7.4 box with TightVNC service enabled on boot and sometimes the service fails to start with a PAM permission denied error:
systemd[2027]: pam_nologin(login:account): conversation failed
systemd[2027]: Failed at step PAM spawning /usr/bin/vncserver: Operation not permitted
systemd[1]: vncserver@:1.service: control process exited, code=exited status=224
systemd[1]: Failed to start Remote desktop service (VNC).
systemd[1]: Unit vncserver@:1.service entered failed state.
systemd[1]: vncserver@:1.service failed.
But after boot if I simply restart the service it starts successfully.
I'm not sure what's causing this issue, or if it's a precedence issue during systemd startup on boot.
The service file was created this way:
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target
[Service]
Type=forking
User=vncuser
PAMName=login
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=-/usr/bin/vncserver -kill %i
ExecStart=/usr/bin/vncserver %i -geometry 1280x1024 -nolisten tcp
PIDFile=/home/vncuser/.vnc/%H%i.pid
ExecStop=-/usr/bin/vncserver -kill %i
[Install]
WantedBy=multi-user.target
RHEL 7.4 is fully updated until it was possible, since the subscription does not offer EUS.
Thanks