I'm trying to configure VNC server for remote logins on a fresh install of CentOS 7, but I just can't seem to get it working right.
I've followed the install steps here including the firewall-cmd steps, but when I run systemctl status vncserver@:1.service, I see:
Loaded: loaded (/etc/systemd/system/vncserver@:1.service; enabled; vendor preset: disabled)
Active: inactive (dead) since <~4 seconds after start time>
Main PID: 1462 (code=exited, status=0/SUCCESS)
<start time> localhost.localdomain systemd[1]: Starting Remote desktop service (VNC)...
<start time+3> localhost.localdomaind systemd[1]: Started Remote desktop service (VNC).
When I instead try to run vncserver manually (as su – remote-user), the log output (in /home/remote-user/.vnc/localhost.localdomain:1.log) is:
vncext: VNC extension running!
vncext: Listening for VNC connections on all interface(s), port 5901
vncext: created VNC server for screen 0
Killing Xvnc process ID 17085
Other thing that may be causing or contributing to the issue:
In /etc/systemd/system/vncserver@:1.service, the line:
PIDFile=/home/remote-user/.vnc/%H%i.pid
Doesn't appear to generate any .pid files. /home/remote-user/.vnc contains no files ending in .pid; this may be because the vnc process doesn't live long enough to create them, but I'm not sure.
Best Answer
Just check your /home/username/.vnc/xstartup file and remove the last line
This is how it looked in my case:
vncserver -kill $DISPLAY is definetely not something we want in xstartup, just remove it