fix: self-healing permissions on /var/lib/syncserver

- systemd: add ExecStartPre to chown -R the data dir before every start
- postinst: add chown -R after creating dirs to fix ownership on upgrades

This prevents the service from failing if dirs were created by root or
drifted ownership after a manual run.
This commit is contained in:
2026-07-07 15:41:10 -04:00
parent 9038e3a000
commit 4cc93c7747
3 changed files with 3 additions and 0 deletions
+1
View File
@@ -10,6 +10,7 @@ case "$1" in
install -d -o syncserver -g syncserver -m 0750 /var/lib/syncserver/data || true
install -d -o syncserver -g syncserver -m 0750 /var/lib/syncserver/ssh || true
install -d -o syncserver -g syncserver -m 0750 /var/lib/syncserver/logs || true
chown -R syncserver:syncserver /var/lib/syncserver
install -d -o root -g root -m 0755 /etc/syncserver || true
if [ ! -f /etc/syncserver/config.yaml ]; then
@@ -8,6 +8,7 @@ Wants=network-online.target
Type=simple
User=syncserver
Group=syncserver
ExecStartPre=/bin/chown -R syncserver:syncserver /var/lib/syncserver
ExecStart=/usr/bin/syncserver --config /etc/syncserver/config.yaml --data-dir /var/lib/syncserver
Restart=on-failure
RestartSec=5