最近在配置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