最近在配置centos7中安装vncserver。html
按照下面手顺进行了配置。centos
http://www.centoscn.com/image-text/install/2015/0509/5394.html服务器
可是老是报错。centos7
Jun 22 18:33:52 host-192-168-118-129 systemd[1]: Starting Remote desktop service (VNC)... Jun 22 18:34:05 host-192-168-118-129 systemd[1]: PID file /home/root/.vnc/host-192-168-118-129:1.pid not readable (yet?) ...start. Jun 22 18:34:05 host-192-168-118-129 systemd[1]: Failed to start Remote desktop service (VNC). Jun 22 18:34:05 host-192-168-118-129 systemd[1]: Unit vncserver@:1.service entered failed state. Jun 22 18:34:05 host-192-168-118-129 systemd[1]: vncserver@:1.service failed.
经过调查,发现若是是配置root用户的状况下,须要将配置文件进行以下修改。code
ExecStart=/sbin/runuser -l root -c "/usr/bin/vncserver %i" PIDFile=/root/.vnc/%H%i.pid
链接vnc服务器时候,记得要写链接哪一个窗口。server