0

I have installed a VNC server but there is a problem, when restarting I lose the geometry and color depth configuration.

Having to stop service, reconfigure geometry and color depth.

Someone knows how these data can be configured so that they are still present at restart.

This is what I've done to install and configure the server:

yum install tigervnc-server -y
cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service

Then I have edited the copied file modifying the following lines:

User=root   
PIDFile=/root/.vnc/%H%i.pid

Then I have continued with the following commands:

vncpasswd (set password...)

systemctl daemon-reload
systemctl enable vncserver@:1.service
systemctl start vncserver@:1.service
systemctl stop vncserver@:1.service
vncserver :1 -geometry 1366x768 -depth 16

firewall-cmd --permanent --add-service vnc-server
systemctl restart firewalld.service

Regards

xav
  • 153
  • 2
  • 5

1 Answers1

0

Try to add the following line to your Unit file (/etc/systemd/system/vncserver@:1.service)

ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 :1

Here is the complete Unit file in my system (an Ubuntu 17.04 system):

[Unit]
Description=Start TightVNC server at startup
After=syslog.target network.target

[Service]
Type=forking
User=username_here
PAMName=login
PIDFile=/home/username_here/.vnc/%H:1.pid
ExecStartPre=-/usr/bin/vncserver -kill :1 > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -depth 16 -geometry 1366x768 :1
ExecStop=/usr/bin/vncserver -kill :1

[Install]
WantedBy=multi-user.target
Vikelidis Kostas
  • 967
  • 1
  • 6
  • 16
  • Hi Vikelidis, I tried but it didn't work. This is my current configuration: `[Service] Type=forking User=root # Clean any existing files in /tmp/.X11-unix environment ExecStartPre=-/usr/bin/vncserver -kill %i ExecStart=/usr/bin/vncserver -depth 16 -geometry 1366x768 :1 PIDFile=/root/.vnc/%H%i.pid ExecStop=-/usr/bin/vncserver -kill %i [Install] WantedBy=multi-user.target` – xav Jan 16 '18 at 12:38