Account recovery & re-running setup
Regain admin access after a lost password, and the operator procedure to re-open the first-run setup wizard.
This runbook covers two related situations:
- You lost the administrator password and need to get back in.
- You want to re-run the first-run setup wizard (
/setup) — for example, to start the platform over from scratch.
Read the next section first: it explains why /setup does not simply re-open, so you choose the right recovery path.
Why /setup won't re-open on its own
The setup wizard is gated on whether any human user account exists — not on a "setup is done" toggle you can flip back.
When the browser loads /setup, the platform asks the auth service for setup status. That status is computed from the auth database: if at least one non-system user exists in the user table, setup is considered complete and /setup immediately redirects to /auth/sign-in. Migration-seeded system+…@scrydon.internal service actors are ignored. The wizard created your human administrator account, so the wizard is closed.
There is a setup_completed flag stored in the platform_config table, but it does not control whether the wizard re-opens. It exists only to protect the one-time "promote the person who finishes setup to super-admin" step from being replayed. The gate the UI actually checks is "does any human user exist?". Auto-healing the wizard off the user table means an environment that lost the flag (e.g. after a migration) can never get re-stuck in the wizard.
So there are two distinct outcomes:
- Keep your data, just get back in → reset the password (recommended).
- Genuinely start over → an operator must remove every human user so the wizard re-opens. This is destructive — see the warning below.
Recommended: reset the password (keeps everything)
This is almost always what you want. Nothing is deleted; the locked-out admin simply gets a new password.
If email delivery is configured
- Go to
/auth/forgot-password. - Enter the administrator's email address.
- Follow the reset link delivered to that mailbox.
A passwordless magic link at /auth/magic-link works the same way — enter the email, click the link, then set a new password under Settings → Account.
Both paths require working email delivery (the SMTP / Resend / SendGrid provider you configured during setup). If the colleague who knows the password is on holiday but can still receive mail, they can complete this themselves from anywhere.
If email delivery was skipped during setup
The Email step in the wizard is optional, so a deployment can reach this state with no way to send a reset link. In that case, an operator with cluster access has to step in. In order of preference:
- Restore from a recent backup taken while the password was still known — see Backup & restore.
- Set the password through the running
api-platformservice. Passwords are stored in theaccounttable as a salted hash produced by Better Auth's own hasher, so you cannot paste a plaintext password in withpsql— it has to be hashed the same way. Use the auth service's admin password-set path rather than editing the column directly. Contact Scrydon support if you need help wiring this up. - Re-run setup (destructive) — only if there is no data worth preserving. See the next section.
Do not try to "fix" email by inserting SMTP credentials directly into platform_config with SQL. The smtp_password and email_api_key values are meant to be encrypted at rest by the secrets layer. A hand-inserted plaintext row is stored unencrypted — the default local provider reads it back via plaintext passthrough so it may appear to work, but behaviour varies by secret provider (BYOK/HYOK may reject or mishandle it), and you've left a credential sitting in the clear. Reconfigure email through the wizard or Settings → Email so the values are encrypted correctly.
Last resort: re-run the setup wizard (destructive)
This re-opens /setup by removing every human user account while retaining the platform's synthetic service actors. Use it only when you intend to start over.
This deletes all human user accounts and everything keyed to them. The delete cascades broadly across the auth schema — credential and OAuth accounts, sessions, passkeys, organization and team memberships, pending invitations, org-chart assignments, clearances, and any personal workspaces owned by a user (workspace.owner_user_id). It can also orphan data in the other databases (agentic, analytics, ontology) that references now-deleted workspace or environment IDs. Your shared organizations themselves survive (they have no foreign key to user) but become inaccessible — re-running the wizard creates a brand-new organization, and the old one has no members attached to it. Take a backup first.
An operator with database access runs this against the auth database. For the bundled in-cluster Postgres:
kubectl exec -it deploy/db -n scrydon-platform -- \
psql -U postgres -d authFor a managed Postgres instance, connect to the auth database with your usual client. Then:
-- 1. Remove human users. Preserve only the canonical migration-seeded actor
-- UUIDs, which retain stable foreign-key identities for audit events.
DELETE FROM "user"
WHERE id NOT IN (
'00000000-0000-0000-0000-000000000a01',
'00000000-0000-0000-0000-000000000a02',
'00000000-0000-0000-0000-000000000a03',
'00000000-0000-0000-0000-000000000a04',
'00000000-0000-0000-0000-000000000a05',
'00000000-0000-0000-0000-000000000a06',
'00000000-0000-0000-0000-000000000a07',
'00000000-0000-0000-0000-000000000a08',
'00000000-0000-0000-0000-000000000a09',
'00000000-0000-0000-0000-000000000a10'
);
-- 2. Clear the setup-completion flag. Recommended hygiene: it resets the
-- completion / replay-protection state to a fresh-install baseline. The
-- new admin is promoted to super-admin when the wizard completes.
DELETE FROM platform_config WHERE key = 'setup_completed';Then visit /setup and complete the wizard again.
Notes:
- Your license survives. It lives in
platform_config(license_jwt), which is untouched, so the wizard's License step shows as pre-validated. - Email config survives in
platform_configbut is now attached to the old (orphaned) organization for org-scoped values; re-confirm it in the new org via Settings → Email. - If you want to keep the existing organization and its data, do not use this procedure — recover the password instead (see above), or contact Scrydon support to re-attach a recovered admin to the existing organization.
Quick reference
| Situation | Action |
|---|---|
| Lost password, email works | Self-service /auth/forgot-password or /auth/magic-link |
| Lost password, email skipped | Restore from backup, or operator sets password via api-platform |
| Want to start completely over | Operator: delete human users while preserving service actors + clear setup_completed, then /setup |
| Want to keep org data | Never delete users — recover the password instead |