Password Authentication
Password authentication uses the typical username and password to login a user. Password authentication also supports Signup, recaptcha, and Two-Factor Authentication features.
Configure source access for new users
Authentication alone does not grant file access. When a user is created (password signup, admin/CLI create, or first login via OIDC / LDAP / JWT / proxy), they only receive sources where config.defaultEnabled: true.
- Default is
false— without this, new users may log in but see no files - One source in config: FileBrowser auto-enables
defaultEnabledfor that source - Multiple sources: set
defaultEnabled: trueon each source new users should access
See Sources: defaultEnabled for full details and examples.
Basic Configuration
Options
| Option | Default | Description |
|---|---|---|
enabled | true | Enable password authentication |
adminUsername | admin | Built-in password admin username |
adminPassword | — | v2.x beta: random speakable password (word-xxxxx-xx) logged once when unset or admin; bootstrap admin gets requirePasswordChange. Any other value is used as-is |
minLength | 5 | Minimum password length |
signup | false | Allow user self-registration |
enforcedOtp | false | Require all password users to enable Two-Factor Authentication |
With User Signup
Set Admin Password
If password authentication is enabled, FileBrowser creates a built-in admin password on first startup. The username defaults to admin.
If adminPassword is unset or left as admin (including when auth.methods.password.adminPassword is unset or admin), a random speakable bootstrap password is generated, logged once, and the admin account is flagged requirePasswordChange so login is blocked until a new password is set. The generated form is word-xxxxx-xx (a random word from a fixed list, a 5-character code, and a 2-character code) instead of a long hex string. v2.0+ uses this format.
Best practice - use an environment variable:
| |
Config-based admin password
If adminPassword is set in config, it is reset on every startup to that value. Prefer FILEBROWSER_ADMIN_PASSWORD for production.
Require password change (v2.0.0)
Password-based users can be required to set a new password before any other login succeeds:
- User defaults:
userDefaults.account.requirePasswordChange(also configurable under Settings → User management → User defaults). - Per user: admins can toggle Require password change when editing a user.
- Bootstrap admin: when the initial admin password is generated (unset/
adminconfig as above),requirePasswordChangeis set automatically.
When requirePasswordChange is true, normal login returns a change-password flow in the UI. The API endpoint is POST /api/auth/password/change-required (current password in the X-Password header; new password in the JSON body). After a successful change, the flag is cleared.
Two-Factor Authentication (2FA)
Two-Factor Authentication (2FA) adds an extra layer of security to password-based logins by requiring a time-based one-time password (TOTP) in addition to the username and password.
Two-Factor Authentication is only available for password authentication users. It does not apply to proxy or OIDC authentication methods.
Benefits of Two-Factor Authentication
- Enhanced Security: Even if a password is compromised, attackers cannot access the account without the 6-digit code
- Protection Against Phishing: 2FA codes are time-limited and cannot be reused
- Compliance: Meets security requirements for many organizations and regulations
- User Control: Users can enable or disable 2FA from their profile settings unless
enforcedOtpis set underauth.methods.password.
How It Works
- Setup: User enables 2FA in their profile settings
- QR Code: A QR code is displayed that can be scanned with authenticator apps (Google Authenticator, Authy, Microsoft Authenticator, etc.)
- Verification: User enters a 6-digit code from their authenticator app to complete setup
- Login: After entering username and password, users with 2FA enabled must enter the current 6-digit code from their authenticator app
- Time-Based: Codes refresh every 30 seconds and are valid for 2 minutes
Configuration
Generate TOTP Secret
Before enabling 2FA, you must generate a secure encryption key for TOTP secrets. This key encrypts user TOTP secrets in the database.
Generate a secure random key using OpenSSL:
| |
Add the generated key to your configuration:
Security Best Practice: Store the totpSecret in an environment variable rather than in the config file:
| |
Important: Changing the totpSecret after users have enabled 2FA will make all active users with 2FA enabled unable to sign in. An admin user would need to reset/disable user’s 2FA in order for users to login – or use CLI to reset a user’s password which also resets 2FA.
(preferred) Admin: User Management → Edit user → Disable 2FA
CLI: perform password reset on a user CLI password reset
Enforce Two-Factor Authentication
Require all password users to enable 2FA:
When enforcedOtp: true:
- New password users must set up 2FA before they can log in
- Existing password users without 2FA cannot log in until they enable it
- Users are prompted to set up 2FA on their first login after enforcement is enabled
User Management
Replacing or resetting an existing TOTP secret via POST /api/auth/otp/generate and POST /api/auth/otp/verify requires an authenticated session as the same user or as an admin.
Enable 2FA (User)
Users can enable 2FA from their profile settings:
- Go to Profile → Security
- Click Enable 2FA or Generate New OTP
- Scan the QR code with an authenticator app
- Enter the 6-digit code to verify and complete setup
Admin Management
Administrators can manage 2FA for any user:
- Go to User Management
- Edit the user
- In the user edit dialog, toggle 2FA on or off
- Click Generate New OTP to reset a user’s 2FA (useful if they lost their device)
Reset 2FA via CLI
If a user loses access to their authenticator device, administrators can reset their password and 2FA using the CLI. See CLI password reset for details.
Resetting a user’s password via CLI also clears their Two-Factor Authentication. The user will need to set up 2FA again after logging in with the new password.
Next Steps
- OIDC authentication
- Manage users
- CLI commands for user management