From 800be8df9b05a418ce12a1404dcc3bac27dece49 Mon Sep 17 00:00:00 2001 From: Tyler Date: Mon, 19 Oct 2026 18:42:09 -0700 Subject: [PATCH] loosen permission lol --- install.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index 87d7e43..ff0f01d 100755 --- a/install.sh +++ b/install.sh @@ -52,12 +52,20 @@ else echo "Keeping existing $dest/.env" fi -echo "Setting permissions (code read-only to kjv; only logs/ and data/ writable)" -chown -R root:root "$dest" -find "$dest" -type d -exec chmod 755 {} + -find "$dest" -type f -exec chmod 644 {} + -chmod 755 "$dest"/*.sh -chown root:kjv "$dest/.env" +# Admins manage the install through the kjv group (the service's own group). +admin_user="${KJV_ADMIN_USER:-$SUDO_USER}" +if [[ -n "$admin_user" && "$admin_user" != root ]] && id "$admin_user" >/dev/null 2>&1; then + echo "Adding $admin_user to group kjv (log out and back in to apply)" + usermod -aG kjv "$admin_user" +else + echo "No admin user detected; set KJV_ADMIN_USER=name to add one to the kjv group" +fi + +echo "Setting permissions (code group-writable by kjv; .env, logs and data limited)" +chown -R root:kjv "$dest" +find "$dest" -type d -exec chmod 2775 {} + +find "$dest" -type f -exec chmod 664 {} + +chmod 775 "$dest"/*.sh chmod 640 "$dest/.env" # SQLite needs a writable directory for journal files chown kjv:kjv "$dest/logs" "$dest/data"