Updated: 28 September 2026 · Applies to: n8n 2.40 (Docker Compose)
If you forgot the password of your self-hosted n8n and have no email (SMTP) set up for password resets, you can reset user management from the server with n8n's command line. Read the warning first: this command removes all user accounts.
Try the normal reset first
- On the login page click Forgot my password.
- This only works when n8n can send email (SMTP is configured). If you receive no email, use the command below.
Reset user management from the server
The command returns n8n to its state before the owner account was created. It removes all user accounts. Make a backup first (How to back up and restore n8n (workflows, credentials and encryption key)?).
- Log in to the server over SSH.
- Go to the folder with your
compose.yamland run the command inside the n8n container:cd ~/n8n-compose sudo docker compose exec n8n n8n user-management:reset
For a container that was started withdocker run --name n8n, usesudo docker exec -it n8n n8n user-management:reset. - Restart n8n so that it loads the new state:
sudo docker compose restart n8n
- Open n8n in your browser. It shows the owner setup screen again: enter your email address and a new password.
- Check your workflows and credentials. If an item is missing, restore the backup from step 1 (How to back up and restore n8n (workflows, credentials and encryption key)?).
If one user lost their two-factor codes
You do not need to reset everything. Switch off the two-factor login for that user; they can set it up again after logging in:
sudo docker compose exec n8n n8n mfa:disable --email=user@example.com
Set up email so this does not happen again
Configure SMTP for n8n so that password reset emails work. The settings are environment variables such as N8N_EMAIL_MODE=smtp and N8N_SMTP_HOST; see n8n's environment variable reference for the full list.
Frequently asked questions
Do I lose my workflows?
The command is documented as removing the user accounts. Take the backup anyway, and check your workflows and credentials right after the reset.
Where do I run the command?
On the server, inside the n8n container as shown above. It cannot be run from the n8n web interface.
Official documentation: n8n documentation: command line.
Need a server for n8n, or a hand with the setup?
- n8n VPS hosting: a VPS made for self-hosted n8n.
- n8n setup service: we install n8n on your own server with SSL, backups and security.
- n8n automation services: workflows, integrations and consulting.
Prefer a hand with the setup? Our engineers can do it for you: Hire an Expert, or use our on-demand server management.