loosen permission lol
This commit is contained in:
+14
-6
@@ -52,12 +52,20 @@ else
|
|||||||
echo "Keeping existing $dest/.env"
|
echo "Keeping existing $dest/.env"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Setting permissions (code read-only to kjv; only logs/ and data/ writable)"
|
# Admins manage the install through the kjv group (the service's own group).
|
||||||
chown -R root:root "$dest"
|
admin_user="${KJV_ADMIN_USER:-$SUDO_USER}"
|
||||||
find "$dest" -type d -exec chmod 755 {} +
|
if [[ -n "$admin_user" && "$admin_user" != root ]] && id "$admin_user" >/dev/null 2>&1; then
|
||||||
find "$dest" -type f -exec chmod 644 {} +
|
echo "Adding $admin_user to group kjv (log out and back in to apply)"
|
||||||
chmod 755 "$dest"/*.sh
|
usermod -aG kjv "$admin_user"
|
||||||
chown root:kjv "$dest/.env"
|
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"
|
chmod 640 "$dest/.env"
|
||||||
# SQLite needs a writable directory for journal files
|
# SQLite needs a writable directory for journal files
|
||||||
chown kjv:kjv "$dest/logs" "$dest/data"
|
chown kjv:kjv "$dest/logs" "$dest/data"
|
||||||
|
|||||||
Reference in New Issue
Block a user