Skip to content

Immich user deletion: all or part

Immich user removal operates on the metadata layer; the CLI uses --uuid to identify accounts. This note documents the commands for single and bulk deletion, associated risks, and safe alternatives for self-hosted instances.

Preparation and deletion commands

Before removing an account, verify the Immich container is running and the CLI is accessible. In a typical self-hosted Linux setup, user management is available from inside the container via docker exec or from the host if the CLI is configured to connect to the database.

docker exec -it immich-app immich user list --output json | jq -r '.[].uuid'

The primary flag recurring across all scenarios is --uuid. The user identifier can be obtained from the web interface by clicking the profile, or by querying the list above. A common error at this stage is attempting deletion without the UUID, resulting in an “invalid user id” error.

Warning

Deleting a user via CLI does not remove the media files from disk, but it clears bindings and access permissions. Take a database backup before any large‑scale operation.

Deleting a specific user

Single account deletion uses one command. The syntax follows the Lead DevOps style: minimal flags, clear result.

immich user delete --uuid <user-uuid>

After execution, Immich marks the user as deleted, detaches their albums, and frees license slots (in self-hosted setups with user limits). Media files uploaded by that user remain in storage but are no longer displayed in the general view unless albums are explicitly removed.

If the album itself must be deleted along with its files, use the album command:

immich album delete --uuid <album-uuid>

Table of key flags for the single‑user deletion scenario:

FlagPurposeExample
--uuidUser or album identifier--uuid 123e4567-e89b-12d3-a456-426614174000
--outputOutput format for scripts--output json
Tip
CommandDescription
immich user listShow all users with UUIDs
immich user delete --uuid <id>Delete user, preserve media
immich album delete --uuid <id>Fully delete album and files

Bulk deletion of all users

Immich does not provide a single flag to delete all users. The cleanup of the entire database requires a scripted wrapper. A common approach on Linux: collect UUIDs, iterate through the list, and execute deletion.

Example bash script:

#!/usr/bin/env bash
set -euo pipefail

UUIDS=$(docker exec -it immich-app immich user list --output json | jq -r '.[].uuid')

for UUID in $UUIDS; do
    echo "Deleting user $UUID..."
    docker exec -it immich-app immich user delete --uuid "$UUID"
done

echo "Mass deletion complete."

Before running such a script in a production environment, test it on a staging instance. Bulk deletion breaks links in shared albums, revokes access to common libraries, and may cause PostgreSQL integrity errors if users have attached metadata.

Warning
RiskConsequence
Deleting the system userBroken connections, container startup errors
Skipping dependenciesCorrupted albums, lost shared‑access settings

Data security and alternatives to rm -rf

Avoid direct file or database deletion with rm -rf or docker volume rm without understanding Immich’s structure. Production installs use PostgreSQL for metadata, while original photos and videos reside in the configured DATA_DIR. Wiping the database without a rollback leads to irreversible loss of album history, comments, and privacy settings.

Safe alternatives that respect Immich’s functional boundaries:

  1. Use the CLI — immich user delete and immich album delete guaranteedly update indexes and references.
  2. Disable the account — change the password or block access via the admin UI, leaving data intact.
  3. Create a backup — pg_dump the Immich database before any user‑related changes. In compose configurations this can be automated via a backup service.

Table comparing approaches to data cleanup:

MethodSafetyRestorabilityRecommendation
immich user delete --uuidHigh (updates indexes)Full (via backup)Operational scenario
rm -rf /immich/dataLowNoneForbidden in production
docker volume rm immich_dbMediumPartial (depends on snapshots)Only during reinstallation
Note
SettingAction
IMMICH_BACKUP_ENABLED=trueAutomatic snapshots of the database before user deletion
IMMICH_DATA_DIRVerify the path is correct before mass album deletion

Automation via scripts and compose

For regular maintenance of a self‑hosted Immich infrastructure, wrapping deletion operations in scripts scheduled or triggered as needed is practical. Example Docker‑compose addition of a one‑shot service:

services:
  immich:
    image: ghcr.io/immich/immich:latest
    # ... existing config ...

  cleanup-user:
    image: ghcr.io/immich/immich:latest
    depends_on:
      - immich
    entrypoint: ["sh", "-c"]
    command:
      - |
        UUIDS=$(immich user list --output json | jq -r '.[].uuid')
        for UUID in $UUIDS; do
          immich user delete --uuid "$UUID"
        done

After updating the config, verify with docker compose config to catch syntax errors. Following script execution, a useful check is:

immich user list --output json | jq length

This confirms the user count has decreased or the list is cleared. Automation frees administrators from routine tasks, but strict UUID list control is essential; otherwise the risk of removing necessary accounts remains high.