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.
Basic Configuration
Options
| Option | Default | Description |
|---|---|---|
enabled | true | Enable password authentication |
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
With reCAPTCHA
Set Admin Password
If password authentication is enabled, by default filebrowser will create a default admin user. This admin user is uniquely able to have the password set by the config. This happens automatically on startup if you specify an admin password via environment variable or config file.
Best practice - use environment variable:
| |
Config based admin password
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
enforceOtpis configured in the server config.
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
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