#!/usr/bin/env bash echo "==============================================" echo "Electron chrome-sandbox permission fixer" echo "==============================================" echo "This script requires sudo permissions to fix" echo "Electron app permissions." echo "" # Find all electron sandbox paths echo "Finding Electron chrome-sandbox instances..." SANDBOX_PATHS=$(find /nix/store -name chrome-sandbox -type f -executable 2>/dev/null) if [ -n "$SANDBOX_PATHS" ]; then count=$(echo "$SANDBOX_PATHS" | wc -l) echo "Found $count chrome-sandbox instances" # If we get here, we're running with sudo echo "$SANDBOX_PATHS" | while read -r SANDBOX_PATH; do if [ -e "$SANDBOX_PATH" ]; then echo "Setting permissions for $SANDBOX_PATH" sudo chown root:root "$SANDBOX_PATH" || echo "Failed to set owner for $SANDBOX_PATH" sudo chmod 4755 "$SANDBOX_PATH" || echo "Failed to set permissions for $SANDBOX_PATH" fi done echo "All permissions set successfully" else echo "Could not find any Electron chrome-sandbox paths" fi