Skip to main content
The n8n CLI provides commands for managing users and resetting the instance to its default user state. This is particularly useful for development, testing, and troubleshooting.

Reset Command

The user-management:reset command resets the database to the default user state, making the instance owner the sole user and owner of all workflows and credentials.

Usage

n8n user-management:reset

What It Does

The reset command performs the following actions:
  1. Transfers All Ownership: Makes the instance owner the owner of all workflows and credentials
  2. Deletes Other Users: Removes all users except the instance owner
  3. Resets Owner Details: Clears the owner’s personal information:
    • First name → null
    • Last name → null
    • Email → null
    • Password → null (requires setup on next login)
    • Last active timestamp → null
  4. Handles Orphaned Data: Links any unassociated credentials to the owner’s personal project
Warning: This command is destructive and cannot be undone. All users except the instance owner will be permanently deleted, and the owner’s credentials will be reset.

Use Cases

Clean up test users and data during development:
n8n user-management:reset
Perfect for resetting a development instance to a clean state.

Behavior Details

Owner Identification

The command identifies the instance owner as:
  • The user with the global:owner role
  • If no owner exists, creates a new default owner user

Personal Project Handling

The owner’s personal project is used for all ownership transfers:
  1. All workflows are assigned to the owner’s personal project
  2. All credentials are assigned to the owner’s personal project
  3. Orphaned credentials (without any owner) are linked to this project

Default Owner State

After reset, the owner user has these properties:
{
  firstName: null,
  lastName: null,
  email: null,
  password: null,
  lastActiveAt: null,
  role: "global:owner"
}

Post-Reset Setup

After running the reset command:
  1. Restart n8n:
    n8n start
    
  2. Access Setup Wizard:
    • Navigate to your n8n URL (e.g., http://localhost:5678)
    • You’ll be redirected to the setup wizard
    • Create new owner credentials
  3. Configure Instance:
    • Set owner email and password
    • Configure instance settings
    • Add additional users if needed

Safety Considerations

Always create a backup before running the reset command:
# Export all workflows
n8n export:workflow --backup --output=backup/workflows/

# Export all credentials (encrypted)
n8n export:credentials --backup --output=backup/credentials/

# Now safe to reset
n8n user-management:reset
Never run this on a production instance unless you fully understand the consequences:
  • All user accounts (except owner) will be deleted
  • All user sessions will be invalidated
  • All users will lose access immediately
  • Owner credentials will be reset
  • This operation cannot be undone
The reset command preserves:
  • ✅ All workflows
  • ✅ All credentials (data intact)
  • ✅ Workflow execution history
  • ✅ System settings
But deletes:
  • ❌ All users except owner
  • ❌ Owner’s personal information
  • ❌ User sessions
  • ❌ User preferences

Example Workflows

Development Reset Workflow

#!/bin/bash

# Stop n8n
echo "Stopping n8n..."
pkill -f n8n

# Wait for shutdown
sleep 2

# Reset to default user state
echo "Resetting user management..."
n8n user-management:reset

# Start n8n
echo "Starting n8n..."
n8n start > /dev/null 2>&1 &

echo "Reset complete. Access setup wizard at http://localhost:5678"

Emergency Access Recovery

If you’ve lost access to the instance owner account:
1

Stop n8n

Stop the n8n process:
# Using systemd
sudo systemctl stop n8n

# Or using PM2
pm2 stop n8n

# Or using process kill
pkill -f n8n
2

Run Reset Command

Execute the reset command:
n8n user-management:reset
This will reset the owner account while preserving all workflows and credentials.
3

Restart n8n

Start n8n again:
# Using systemd
sudo systemctl start n8n

# Or using PM2
pm2 start n8n

# Or directly
n8n start
4

Complete Setup

Access the n8n UI and complete the setup wizard to create new owner credentials.

User Management Alternatives

For less destructive user management, use the n8n UI:

Via Web Interface

  1. Settings > Users: Manage user accounts
  2. Access Control: Configure user permissions
  3. User Roles: Assign roles to users
  4. Audit Log: Track user activities

Via API

For programmatic user management, use the n8n REST API:
curl -X GET http://localhost:5678/api/v1/users \
  -H "X-N8N-API-KEY: your-api-key"

Troubleshooting

Problem: The reset command encounters an error.Solutions:
  • Ensure n8n is stopped before running reset
  • Check database connectivity
  • Verify database permissions
  • Check logs for specific error messages
Problem: Cannot access n8n UI after reset.Solutions:
  • Ensure n8n was restarted after reset
  • Clear browser cache and cookies
  • Try accessing in incognito/private mode
  • Check n8n logs for startup errors
Problem: Workflow metadata shows previous owner.Solution: This is expected. The reset command changes actual ownership (who can access/modify) but historical metadata may remain. The owner can access and modify all workflows.

Environment-Specific Considerations

When running in Docker:
# Stop container
docker stop n8n

# Run reset
docker exec n8n n8n user-management:reset

# Restart container
docker start n8n
Or if container is not running:
docker run --rm \
  -v n8n_data:/home/node/.n8n \
  n8nio/n8n \
  n8n user-management:reset

Best Practices

  1. Always backup first: Export workflows and credentials before reset
  2. Use in development: Primarily for dev/test environments, not production
  3. Communicate changes: Inform team members before running reset
  4. Document recovery: Keep emergency access recovery procedures documented
  5. Test restore: Verify backup/restore procedures work before emergencies
Other useful CLI commands for user and data management:
  • n8n export:workflow: Export workflows for backup
  • n8n export:credentials: Export credentials for backup
  • n8n import:workflow: Restore workflows from backup
  • n8n import:credentials: Restore credentials from backup

Next Steps

CLI Commands

View all CLI commands

Import & Export

Backup and restore data

User Management UI

Manage users via web interface

API Reference

Use the REST API for user management