`sudo -u app touch /var/log/app/x.log` works, but the app itself (running as `app` under systemd) gets `EACCES` on the same path.
AdvancedTroubleshootingPermissions, ownership, SELinux and mounts
Answer
Likely causes → systemd sandboxing: ProtectSystem=strict makes /var read-only unless listed in ReadWritePaths=, or ProtectHome, PrivateTmp, or an SELinux domain differs between the shell and the service.
Diagnose →
systemctl show app -p ProtectSystem -p ReadWritePaths -p ProtectHome
systemctl cat app
sudo ausearch -m AVC -ts recent
Fix → Add ReadWritePaths=/var/log/app (or LogsDirectory=app, which creates and permits /var/log/app), then daemon-reload and restart.
Prevent → Use StateDirectory=, LogsDirectory=, RuntimeDirectory= instead of hand-made directories.
More on Permissions, ownership, SELinux and mounts
nginx returns 403 and logs `open() "/srv/www/index.html" failed (13: Permission denied)`, even after `chmod -R 777 /srv/www`.IntermediateA script fails with `bash: ./deploy.sh: Permission denied` even though `ls -l` shows `-rwxr-xr-x`.BeginnerA script fails with `/bin/bash^M: bad interpreter: No such file or directory`.BeginnerA user gets `-bash: cd: /srv/project: Permission denied` although they're in the group that owns `/srv/project` (mode `770`).BeginnerApache can't connect to a backend: `AH00957: HTTP: attempt to connect to 127.0.0.1:8080 (localhost) failed` and `ausearch` shows `denied { name_connect }`.IntermediateA service fails to bind to a custom port: `bind() to 0.0.0.0:8888 failed (13: Permission denied)` while running as root.Intermediate