#!/bin/bash # Set owner:group on a single file under the data plane. # # runFileOp, not runSystem: the scoped sudoers grants the manager root for the # fixed LibrePortal helpers and systemctl/ufw/nft/sysctl only — never a bare # `sudo chown`, since that is root-equivalent (chown /etc/sudoers). `runSystem # chown` therefore could not succeed on any correctly-installed system; it was # denied every time, and because the result feeds checkSuccess it printed a red # ✗ Error on every prometheus install. runFileOp runs as the owner of the data # plane (the docker install user under rootless, the manager under rooted), which # is exactly who may set these. # # Ownership that genuinely needs root — establishing the /docker model, reclaiming # a root-owned file — belongs in the libreportal-ownership helper instead. updateFileOwnership() { local file="$1" local file_name=$(basename "$file") local user_name_1="$2" local user_name_2="$3" local result; result=$(runFileOp chown "$user_name_1:$user_name_2" "$file") checkSuccess "Updating $file_name with $user_name_1 ownership" }