fix: use sudo for all config.json access in configure_authelia

/home/kiosk/ has 750 permissions so the install user can't read inside
it. The -f check and both jq reads were running as the current user and
failing silently, causing the false "config.json not found" error.

Changed:
  [[ ! -f "$config_file" ]]  →  sudo test -f "$config_file"
  jq -r ... "$config_file"   →  sudo -u kiosk jq -r ... "$config_file"
  jq ... > "$tmp"            →  sudo -u kiosk jq ... > "$tmp" && sudo mv

https://claude.ai/code/session_01EyjEQLWbTXcZgbMDarf7NU
This commit is contained in:
Claude
2026-06-15 23:20:14 +00:00
parent 4c3f5576b9
commit 2556863129
+5 -5
View File
@@ -9979,15 +9979,15 @@ configure_authelia() {
echo
local config_file="$KIOSK_DIR/config.json"
if [[ ! -f "$config_file" ]]; then
if ! sudo test -f "$config_file"; then
echo "✗ config.json not found — run a full install first."
read -r -p "Press Enter to return..." _; return
fi
# Show current status
local current_url current_user
current_url=$(jq -r '.autheliaURL // ""' "$config_file" 2>/dev/null)
current_user=$(jq -r '.autheliaUsername // ""' "$config_file" 2>/dev/null)
current_url=$(sudo -u "$KIOSK_USER" jq -r '.autheliaURL // ""' "$config_file" 2>/dev/null)
current_user=$(sudo -u "$KIOSK_USER" jq -r '.autheliaUsername // ""' "$config_file" 2>/dev/null)
if [[ -n "$current_url" ]]; then
echo "Current config:"
echo " URL: $current_url"
@@ -10025,11 +10025,11 @@ process.stdout.write(Buffer.concat([iv,enc]).toString('base64'));
local tmp
tmp=$(mktemp)
jq --arg url "$authelia_url" \
sudo -u "$KIOSK_USER" jq --arg url "$authelia_url" \
--arg user "$authelia_user" \
--arg enc "$encrypted" \
'. + {autheliaURL: $url, autheliaUsername: $user, autheliaEncryptedPassword: $enc}' \
"$config_file" > "$tmp" && mv "$tmp" "$config_file"
"$config_file" > "$tmp" && sudo mv "$tmp" "$config_file"
sudo chown "$KIOSK_USER:$KIOSK_USER" "$config_file"
echo