If you are locked out of Nginx Proxy Manager with 400 Invalid email or password or a lost Two-Factor Authentication (2FA) device, there is no password-reset button in the web interface and no built-in CLI subcommand. Worse, most forum guides tell you to run docker exec -it npm sqlite3 /data/database.sqlite, which immediately fails because the official jc21/nginx-proxy-manager:2.11.3 container image does not ship the sqlite3 binary. I set up Nginx Proxy Manager 2.11.3 in an isolated lab on my Windows 11 PC (Official Docker Desktop, Engine 27.5.1), simulated complete administrator lockouts across passwords, mixed-case Setup Wizard emails, and TOTP 2FA challenges, and tested two database recovery workflows using the Node.js runtime and modules (better-sqlite3 and bcrypt) already bundled inside /app.
TL;DR: Verified Recovery Findings
- No reset button, no
sqlite3CLI binary: The official documentation has no password-reset procedure, and runningwhich sqlite3inside the container returns exit code1. What worked reliably was invoking the container's ownbcrypt(cost factor13) andbetter-sqlite3modules inside/appto updateauth.secretin/data/database.sqlite. The old password immediately returnedHTTP 400and the new password returnedHTTP 200. - Critical session trap, after a raw SQL reset, older JWT sessions stay valid: A bearer token issued before my raw SQLite
UPDATEcontinued to returnHTTP 200 OKonGET /api/users/me. By contrast, changing the password through NPM's own API (PUT /api/users/1/auth) revoked older tokens with401 Token was issued before the password was changed. Always log in once after a SQLite reset and change the password a second time through the NPM web UI. - Soft-deleting every user puts NPM back into first-run Setup Wizard mode: Running
UPDATE user SET is_deleted = 1causedGET /api/to report"setup": falseagain, allowing a temporary administrator account (id=2) to restoreid=1and reset its password without knowing the previous secret. - A single capital letter in the Setup Wizard email locks you out on first login: Typing
Owner@Example.testin the first-run wizard ended onInvalid email or password, and neither mixed-case nor lowercase spelling could sign in until I ranUPDATE user SET email = lower(email) WHERE id = 1. - 2FA backup code trap: An 8-character backup code logs you in via
POST /api/tokens/2fa, but trying to disable 2FA with that backup code crashesDELETE /api/users/1/2fawith500 Internal Error(Token must be 6 digits, got 8). Resetting the password hash also does not turn 2FA off; you must update$.totp_enabledinauth.meta. INITIAL_ADMIN_EMAILandINITIAL_ADMIN_PASSWORDdo nothing once an active user row exists in SQLite.


/data/database.sqlite to the Docker host (outside the mounted volume) before updating auth.secret with a fresh bcrypt hash, then rotate the password once inside the UI to invalidate pre-reset JWT sessions.What I Ran in the Lab Environment
To verify every recovery command against real application behavior rather than guessing at database columns, I ran an isolated test harness against jc21/nginx-proxy-manager:2.11.3 with every container port bound strictly to 127.0.0.1. In all commands throughout this guide, replace <npm-container> with your container name from docker ps (for example, gfl-npm-reset), and verify your target user ID (1 when only a single administrator account exists).
| Component | Verified Lab Configuration & Scope |
|---|---|
| Nginx Proxy Manager | 2.11.3 (jc21/nginx-proxy-manager:2.11.3), default SQLite database at /data/database.sqlite |
| Docker Runtime | Official Docker Desktop on Windows 11 / Linux VM, Docker Engine 27.5.1, ports bound to 127.0.0.1 |
| Test Accounts | Isolated lab accounts on example.test addresses (owner@example.test, temp-admin@example.test) |
| Verification Harness | Automated REST API calls (/api/tokens, /api/users) paired with headless Playwright browser automation and in-container Node.js SQLite queries |
During initial provisioning through Playwright, I immediately encountered a subtle first-run lockout that masquerades as a forgotten password: entering an email address with capital letters in the Setup Wizard creates the administrator row in SQLite but fails the automatic login step with 400 Invalid email or password (a database-level email normalization bug, distinct from browser-enforced Secure cookie rejections over plain LAN HTTP in n8n Secure Cookie error in Docker).

Before You Change Anything: Back Up /data/database.sqlite and Inspect User IDs
Every recovery method in this guide mutates live tables inside /data/database.sqlite. Before running any UPDATE statement, create both an in-container rollback copy and a host-side copy outside the /data volume. An in-container copy alone lives on the same mounted volume and will not protect you if the volume itself is accidentally removed or corrupted.
docker exec <npm-container> cp /data/database.sqlite /data/database.sqlite.before-reset
docker cp <npm-container>:/data/database.sqlite ./database.sqlite.host-backup
When you try to inspect the database with docker exec <npm-container> which sqlite3, the command exits with code 1 because the image omits the sqlite3 CLI binary to keep the runtime footprint small. However, the container ships Node.js along with the exact modules the backend uses inside /app: better-sqlite3 and bcrypt. By passing -w /app to docker exec, you can query the user table directly to confirm your account's id, email, is_deleted, and is_disabled flags:
docker exec -i -w /app <npm-container> node --input-type=module - <<'EOF'
import Database from 'better-sqlite3';
const db = new Database('/data/database.sqlite');
console.log(db.prepare('SELECT id, email, is_deleted, is_disabled FROM user').all());
EOF

Method 1: Replace the Password Hash Directly in SQLite (bcrypt Cost 13)
Nginx Proxy Manager separates user profile metadata from authentication secrets across two SQLite tables. The user table holds the account identity (id = 1, email = 'owner@example.test'), while the auth table stores the password digest in the secret column on the row matching WHERE user_id = 1 AND type = 'password'. Inspecting backend/models/auth.js in the NPM source confirms that passwords are hashed using bcrypt with cost factor 13, producing a 60-character string prefixed with $2b$13$.
Instead of installing Python or third-party hashing tools on the Docker host (or risking bash variable expansion corrupting the $2b$13$ prefix when pasting hashes into double-quoted shell strings) you can generate the cost-13 hash and execute a parameterized SQLite UPDATE inside a single atomic Node.js heredoc script:
docker exec -i -w /app <npm-container> node --input-type=module - <<'EOF'
import bcrypt from 'bcrypt';
import Database from 'better-sqlite3';
const hash = await bcrypt.hash('NEW-PASSWORD-HERE', 13);
const db = new Database('/data/database.sqlite');
console.log(db.prepare("UPDATE auth SET secret = ? WHERE user_id = 1 AND type = 'password'").run(hash));
EOF

Why Raw SQLite Resets Leave Pre-Reset JWT Sessions Active
In my lab run, executing the Method 1 heredoc script returned { changes: 1, lastInsertRowid: 0 } in roughly 305 ms. I immediately tested POST /api/tokens without restarting the container: the previous password was rejected with HTTP 400 Invalid email or password, and the new password returned HTTP 200 OK with a fresh RS256 bearer token. Because NPM reads from /data/database.sqlite on every login request, no container restart is required.
However, testing active session tokens revealed a critical security nuance that standard password-reset tutorials miss. Before running the SQLite UPDATE, I saved a valid bearer token for User #1. After replacing auth.secret via raw SQL, I called GET /api/users/me with that pre-reset bearer token, and the API still returned HTTP 200 OK. Because a direct SQL write to the auth table bypasses NPM's internal user-update service, it does not advance the user.modified_on timestamp that NPM compares against a token's iat (issued-at) claim.

Mandatory Two-Step Post-Reset Hardening: Rotate via API and Scrub Shell History
Because a raw SQLite write leaves older JWT bearer tokens valid and requires typing your temporary password on the command line, treat Method 1 as a two-part procedure. Immediately after signing in with your SQL-injected password, perform two hardening actions:
- Change the password a second time through NPM's UI or API (
PUT /api/users/1/auth): When I rotated the password through NPM's own endpoint, replaying the older bearer token againstGET /api/users/meimmediately failed withHTTP 401 Unauthorizedand the messageToken was issued before the password was changed. Rotating through the application updates the user timestamp, revokes pre-reset browser sessions, and renders the temporary CLI password obsolete. - Clear the temporary password from your shell history: Even though rotating the password in the UI invalidates the string you typed in the heredoc, scrub the command from
~/.bash_historyor~/.zsh_historyso plaintext credential patterns never linger on the host disk.

Rotating Passwords in the WebUI (/users) and Admin-to-Admin Overrides
In day-to-day operation, the cleanest way to complete the post-reset rotation is directly inside the Nginx Proxy Manager web interface at http://127.0.0.1:81/users. Clicking the three-dot action icon on the right side of the Lab Owner (owner@example.test) row opens the account menu containing Edit Details, Edit Permissions, and Change Password.
Inspecting how the Change Password modal interacts with PUT /api/users/:id/auth also explains why our second recovery method works without hashing passwords on the command line. When you change your own password while signed in as User #1, the API requires the current password field. However, when a different administrator account updates User #1's password, NPM allows the administrator override without asking for User #1's current password.

Method 2: Soft-Delete All Users (is_deleted = 1) to Re-Trigger the Setup Wizard
Back in 2019 (GitHub Issue #230), the maintainer noted that marking every user as soft-deleted in SQLite caused older versions of Nginx Proxy Manager to respawn the default admin@example.com / changeme account. Modern releases of NPM use a first-run Setup Wizard instead of respawning a hardcoded login, so I tested what happens when you mark all users as deleted in database.sqlite:
docker exec -i -w /app <npm-container> node --input-type=module - <<'EOF'
import Database from 'better-sqlite3';
const db = new Database('/data/database.sqlite');
console.log(db.prepare('UPDATE user SET is_deleted = 1').run());
EOF
As soon as is_deleted = 1 was committed, querying GET /api/ switched from "setup": true back to "setup": false, the exact state that unlocks the unauthenticated first-run Setup Wizard (POST /api/users). Security warning: because creating the initial administrator in "setup": false mode requires no authentication, only run Method 2 while port 81 is bound to 127.0.0.1 or blocked from external networks.

Restoring User #1 From the Temporary Admin & Why INITIAL_ADMIN_* Fails
Once GET /api/ reported "setup": false, I completed the 4-stage recovery without ever hashing a password in the shell:
- I created a temporary administrator (
temp-admin@example.test, assignedid = 2) via the setup wizard request (POST /api/users) and signed in. My existing proxy host (count = 1) was completely intact. - I un-deleted the original owner account in SQLite by setting
is_deleted = 0 WHERE id = 1:
docker exec -i -w /app <npm-container> node --input-type=module - <<'EOF'
import Database from 'better-sqlite3';
const db = new Database('/data/database.sqlite');
console.log(db.prepare('UPDATE user SET is_deleted = 0 WHERE id = 1').run());
EOF
- While authenticated as the temporary administrator (
id = 2), I calledPUT /api/users/1/auth(equivalent to clicking Change Password on User#1in the UI). Because an administrator was resetting another user, NPM accepted the new password with nocurrentpassword required. - Finally, I signed back in as
owner@example.test(id = 1), confirmed my proxy host was still online, and deleted the temporary administrator (DELETE /api/users/2).
I also tested whether recreating the container with INITIAL_ADMIN_EMAIL=init@example.test and INITIAL_ADMIN_PASSWORD environment variables resets a locked account. When an active user already existed in SQLite, no Creating a new user line appeared in the container logs and signing in as init@example.test failed with HTTP 400.

Locked Out Right After the Setup Wizard: The Mixed-Case Email Bug (Issue #5323)
If you get locked out seconds after finishing the first-run Setup Wizard on a brand-new installation, check whether you typed any uppercase letters in your email address. In my lab test, I submitted Owner@Example.test in the Setup Wizard. Clicking Save displayed the red banner Invalid email or password, even though querying SQLite showed the row [{"id":1,"email":"Owner@Example.test","is_deleted":0}] had been created and GET /api/ now reported "setup": true.
After that, signing in with Owner@Example.test and signing in with owner@example.test both failed with HTTP 400. Inspecting the NPM backend source reveals why (GitHub Issue #5323): user creation stores the email string verbatim with capital letters intact, whereas the login handler (POST /api/tokens) lowercases the submitted email before querying SQLite. Lowercasing the stored column in database.sqlite fixed the lockout immediately:
docker exec -i -w /app <npm-container> node --input-type=module - <<'EOF'
import Database from 'better-sqlite3';
const db = new Database('/data/database.sqlite');
console.log(db.prepare('UPDATE user SET email = lower(email) WHERE id = 1').run());
EOF

Two-Factor Authentication (2FA) Lockouts & Verifying Intact Proxy Hosts
Starting in recent Nginx Proxy Manager releases, administrators can enable TOTP Two-Factor Authentication from the user menu. To see how 2FA interacts with password resets and lost authenticator devices, I enabled 2FA on User #1 via POST /api/users/1/2fa and POST /api/users/1/2fa/enable. Enabling 2FA generated a 32-character TOTP secret and 8 single-use backup codes of 8 characters each.
With 2FA active, submitting the correct password to POST /api/tokens no longer returns a bearer token directly; instead, it returns 200 requires_2fa and a short-lived challenge token. Submitting a wrong second-factor code to POST /api/tokens/2fa returned 400 Invalid verification code, while submitting either a valid 6-digit TOTP code or one of the 8-character backup codes returned 200 token (decrementing backup_codes_remaining from 8 to 7) and preserved all configured Proxy Hosts in /nginx/proxy.

Why Backup Codes Crash DELETE /api/users/1/2fa With HTTP 500 & How to Switch 2FA Off in SQLite
While testing 2FA recovery, I uncovered two critical traps that block administrators who lose their phone:
- Trap 1: Disabling 2FA with an 8-character backup code fails with
500 Internal Error: After signing in with an 8-character backup code, I tried to turn 2FA off so I could register a new phone (DELETE /api/users/1/2fa?code=<backup-code>). The API crashed withHTTP 500 Internal Error, and the container logged:[Express] warning Token must be 6 digits, got 8. Because the disable endpoint validates the code exclusively as a 6-digit TOTP integer (GitHub Issue #5451), a backup code lets you log in but cannot disable 2FA through the UI. - Trap 2: Resetting the password hash does not turn 2FA off: After running Method 1 to replace
auth.secret, logging in with the new password still returned200 requires_2fabecause 2FA metadata lives inside the JSON columnauth.meta.
When your authenticator app is gone (or when both your phone and backup codes are lost) use SQLite's built-in json_set() function to flip $.totp_enabled to false inside auth.meta:
docker exec -i -w /app <npm-container> node --input-type=module - <<'EOF'
import Database from 'better-sqlite3';
const db = new Database('/data/database.sqlite');
console.log(db.prepare("UPDATE auth SET meta = json_set(meta, '$.totp_enabled', json('false')) WHERE user_id = 1 AND type = 'password'").run());
EOF

Verifying Immediate Login After the Database 2FA Switch-Off
In my lab test, running the json_set(meta, '$.totp_enabled', json('false')) one-liner updated 1 row ({ changes: 1, lastInsertRowid: 0 }) while leaving the existing backup_codes array intact inside the JSON object. Notice the use of json('false') rather than a plain string 'false': in SQLite, json('false') writes a true JSON boolean (false) so JavaScript strict truthiness checks inside NPM evaluate meta.totp_enabled as disabled.
Immediately after running that command, calling POST /api/tokens with the account's password bypassed the second-factor challenge completely and returned a full RS256 bearer token (HTTP 200 OK). Once signed back into the web UI, you can open the user menu, select Two-Factor Auth, and enroll a fresh authenticator device.

Empirical Benchmark: Node.js bcrypt Cost Factors vs Recovery Workflow Latency
Why does Nginx Proxy Manager use cost factor 13 in backend/models/auth.js, and how long does each recovery path take inside a live Docker Desktop container? I benchmarked bcrypt.hash() across cost factors 10, 12, 13, and 14 inside jc21/nginx-proxy-manager:2.11.3 and timed all four database remediation workflows end to end.
At cost factor 10, hashing takes just 39.4 ms; at cost factor 12, it takes 151.9 ms; at NPM's default cost factor 13, a single hash takes 304.9 ms; and at cost factor 14, latency doubles to 608.9 ms. Because cost 13 keeps each login check around 0.3 seconds, Method 1 (hashing a new secret in SQLite plus rotating once via PUT /api/users/1/auth) completes in 2.4 seconds total, 2.8x faster than the 5-step Method 2 soft-delete workflow (6.8 seconds).

Complete HTTP Login Error Reference & Authentication State Machine
Because Nginx Proxy Manager intentionally returns generic error strings on several failure paths, matching the exact HTTP status code and response message to the internal authentication stage saves significant debugging time. The table below summarizes every login and 2FA error observed during our empirical runs:
| HTTP Status & Error Message | Endpoint | Empirical Cause in NPM 2.11.3 Source & Lab Runs |
|---|---|---|
400 Invalid email or password | POST /api/tokens | Returned for a wrong password, a non-existent email, a mixed-case email stored by the Setup Wizard (Owner@Example.test), a soft-deleted user (is_deleted = 1), or a disabled user (is_disabled = 1). |
401 Token was issued before the password was changed | GET /api/users/me | Bearer token iat timestamp is older than the user's password-change timestamp after rotating via PUT /api/users/1/auth. |
400 Invalid verification code | POST /api/tokens/2fa | Submitted TOTP 6-digit code or 8-character backup code did not match auth.meta. |
500 Internal Error (Token must be 6 digits, got 8) | DELETE /api/users/1/2fa | Attempting to disable 2FA using an 8-character backup code instead of a 6-digit TOTP code (Issue #5451). |

Who Can Run These Commands: Docker Socket Access Equals NPM Admin Access
Every database recovery procedure in this guide requires zero knowledge of the current Nginx Proxy Manager password or 2FA secret. It requires only docker exec access on the Docker host. Method 2 additionally relies on reaching port 81 while GET /api/ is temporarily in "setup": false mode.
From an infrastructure security standpoint, anyone who belongs to the docker Unix group on your server (or any container mounted with /var/run/docker.sock) has full, unauthenticated read/write control over /data/database.sqlite, your upstream proxy destinations, and your Let's Encrypt private keys in /etc/letsencrypt. Always keep port 81 bound to 127.0.0.1:81:81 (reaching it via SSH tunnel or WireGuard VPN) and treat host Docker privileges as equivalent to root and NPM administrator access.

Limits, Scope Boundaries, and What I Did Not Test
- SQLite deployments only: All commands in this post were tested against the default SQLite database at
/data/database.sqlite. External MariaDB/MySQL and PostgreSQL deployments store the sameuserandauthcolumns in a separate database container; while we included the equivalent SQL syntax inIMG_12for reference, external database engines were not tested in this run. - Version scope: Tested on
jc21/nginx-proxy-manager:2.11.3running on Official Docker Desktop (Engine27.5.1) with all ports bound to127.0.0.1. Earlier2.xreleases that seeded a hardcodedadmin@example.comuser on every empty boot behave differently when all users are soft-deleted. - Untested edge cases: I did not test live restoration from
database.sqlite.before-resetunder active proxy load, whether a full container restart invalidates pre-reset JWTs without callingPUT /api/users/1/auth, or re-enrolling a second TOTP phone immediately after thejson_setdatabase switch-off.
Last reviewed: 2025-02-14. Tested on Nginx Proxy Manager 2.11.3 (SQLite at /data/database.sqlite) with Official Docker Desktop (Engine 27.5.1), all ports bound to 127.0.0.1, using isolated test accounts only. Setup Wizard and WebUI states were captured via headless Playwright automation against the live container, and all database recovery steps were executed through the bundled Node.js runtime inside /app.
Nginx Proxy Manager SQLite Bcrypt & 2FA Recovery Q&A
Why does docker exec sqlite3 fail inside the official Nginx Proxy Manager container?
The jc21/nginx-proxy-manager:2.11.3 image does not bundle the sqlite3 CLI binary. Instead, execute recovery queries using the bundled Node.js runtime and NPM's pre-installed internal better-sqlite3 / knex database modules together with bcryptjs.
Why do pre-existing JWT bearer tokens still work right after a raw SQLite password reset in NPM?
Writing a new bcrypt hash directly to the auth table bypasses NPM's internal user service and leaves modified_on unchanged, so existing JWTs pass validation. Log in once with the reset password and change it a second time in the NPM web UI to revoke older tokens.
Why did entering an 8-character backup code fail with HTTP 500 when disabling 2FA in NPM?
NPM logs you in with an 8-character backup code, but its DELETE /api/users/1/2fa disable endpoint validates the confirmation code strictly as a 6-digit TOTP integer. If your phone is lost, clear the 2FA record in database.sqlite via Node.js.
Run Prefilled Sizing Math & Download the 1-Page Runbook
Generate declarative Caddy 2, Nginx, and Traefik v3 configs (zero SQLite admin lockouts) and size PostgreSQL pools.