Overview
TrailBase provides comprehensive CLI commands for managing users and administrators. Unlike the admin UI, CLI commands allow you to modify admin users and perform operations that require elevated permissions.User Commands
All user commands operate on the_user table in the main database. Users can be identified by either email address or UUID.
User Identifiers
Most commands accept a user identifier that can be:string
User’s email address (e.g.,
user@example.com)Must contain an @ symbolstring
User’s unique identifier (e.g.,
550e8400-e29b-41d4-a716-446655440000)Standard UUID formatAdding Users
user add
Create a new verified user with email and password.string
required
Email address for the new user. Must be a valid email format and unique.
string
required
Password for the new user. Not checked against password policies, so choose a strong password.
Users created with
trail user add are automatically marked as verified and can log in immediately.Modifying Users
user change-password
Change a user’s password.string
required
User identifier (email or UUID).
string
required
New password to set for the user.
Password changes take effect immediately. Active sessions remain valid until their tokens expire.
user change-email
Change a user’s email address.string
required
User identifier (email or UUID).
string
required
New email address to set for the user. Must be unique.
user verify
Change a user’s email verification status.string
required
User identifier (email or UUID).
boolean
default:"true"
Verification status to set.
true to verify, false to unverify.Unverified users cannot log in until they verify their email or are manually verified via CLI.
Session Management
user invalidate-session
Invalidate all active sessions for a user, forcing re-authentication.string
required
User identifier (email or UUID).
Example
Active auth tokens remain valid until expiration. Users will need to re-authenticate when their current token expires.
- User reports compromised account
- Force logout after password change
- Security incident response
- User permission changes require re-authentication
user mint-token
Generate an authentication token for a user.string
required
User identifier (email or UUID).
The output is in Bearer token format and can be used directly in Authorization headers for API requests.
- Testing API endpoints
- Automated scripts requiring authentication
- Debugging authentication issues
- Service-to-service authentication
Deleting Users
user delete
Permanently delete a user and all associated data.string
required
User identifier (email or UUID).
- User record from
_usertable - User sessions from
_sessiontable - User avatar from
_user_avatartable - Related records (depending on foreign key constraints)
Admin Management
admin list
List all users with admin privileges.id- User UUIDemail- User email addresscreated- Account creation timestampupdated- Last update timestamp
admin promote
Promote a regular user to admin.string
required
User identifier (email or UUID).
Admin users gain access to the admin UI and all admin API endpoints. Permissions take effect immediately for new sessions.
- Access to Admin UI (
/_admin) - Configuration management
- User management via UI
- Schema management
- Log viewing
- API management
admin demote
Demote an admin user to regular user.string
required
User identifier (email or UUID).
Unlike the admin UI, the CLI allows you to demote yourself. Ensure you have at least one admin user before demoting all admins.
User Import
user import
Bulk import users from external authentication providers.string
Path to Auth0 exported users as newline-delimited JSON (NDJSON) file.
boolean
default:"false"
Validate users without importing. Useful for testing before actual import.
- Validates each user record
- Creates users with verified status
- Hashes passwords securely
- Handles duplicate emails (skips or errors)
- Reports import statistics
Always run with
--dry-run first to validate the import file before performing the actual import.Common Workflows
Creating Your First Admin
Step-by-step: Create first admin user
Step-by-step: Create first admin user
Handling Forgotten Passwords
Step-by-step: Reset user password
Step-by-step: Reset user password
Emergency Admin Access
Step-by-step: Regain admin access
Step-by-step: Regain admin access
Bulk User Operations
Step-by-step: Create multiple users from CSV
Step-by-step: Create multiple users from CSV
Step-by-step: Verify all unverified users
Step-by-step: Verify all unverified users
Security Operations
Step-by-step: Handle compromised account
Step-by-step: Handle compromised account
Troubleshooting
User Not Found
Error:Could not find user: user@example.com
Solutions:
Duplicate Email
Error:User with email already exists
Solutions: