CLI Commands
v2.0.0 behavior change
Starting in v2.0.0, user CLI commands changed. Use user set <username> --password [value] instead of set -u username,password. Use user promote <username> to grant admin without changing the password. The old set -u form still works but prints a deprecation warning on stderr. Docker examples should mount a data directory (not a single database.db file) — see Docker setup.
FileBrowser provides a minimal CLI for setup and user management.
CLI migration (v2.0.0+)
| |
Available Commands
Start Server
Default command - runs the server:
| |
With custom config:
| |
Setup
Create new configuration file:
| |
Generates config.yaml with defaults.
Initialize database
filebrowser init was added in v2.0.x
The command is hidden from the default help list. Its help text is “Initialize the database or migrate from a legacy database”.
| |
It loads the config (-c, or FILEBROWSER_CONFIG, default config.yaml), then:
- Opens the SQLite database at
server.database.path, or creates it when that file does not exist yet - Imports a legacy BoltDB database when
server.database.migrateFrompoints at a populated legacy file and the SQLite file is missing or empty - Exits without starting the HTTP server
Shut down a running server before init. Only one process can use the database.
Version
Check version information:
| |
User Management
Create or update a password-authenticated user:
| |
Prompt for password on a TTY (omit the value):
| |
Read password from stdin (scripts):
| |
Create as admin:
| |
Promote an existing user to admin without changing their password:
| |
user set … -a still resets the password and clears 2FA (same as the old set -u … -a). Prefer user promote when you only need to grant admin.
Deprecated (still works with stderr warning):
| |
Access Rule Management
Create or update access rules via CLI:
Allow user access:
| |
Deny user access:
| |
Allow group access:
| |
Deny all users:
| |
Rule command options:
-s/--source- Source name from config (not the filesystem path)-p/--path- Index path (e.g./secret)-r/--role- Rule category:user,group, orall(for deny only)-v/--value- Username or groupname (not required if-risall)--allow- Allow access (default: false, which means deny)-c/--config- Config file path
Important Notes
Always shut down the server before CLI operations
Only one process can access the database at once.
Docker Usage
Stop Running Container
| |
Run CLI in Container
Inside container:
One-Line Docker Commands
Password reset:
Create user:
Mount the data directory, not a single database file. Official images keep config and the database under /home/filebrowser/data (FILEBROWSER_CONFIG). v1.5.x (stable) stores database.db there. v2.0.0+ (beta) stores database.sqlite there unless server.database.path is set. Use the beta image tag when the data directory is a v2 install.
Common Operations
Password Reset
Important: Resetting a user’s password via CLI also clears their Two-Factor Authentication (2FA). The user will need to set up 2FA again after logging in with the new password.
This is useful if:
- A user forgot their password
- A user lost access to their 2FA device and needs both password and 2FA reset
- You need to reset an account for security reasons
Create New User
| |
Always include config path, so user defaults are applied.
Promote User to Admin
| |
To promote and reset password at the same time:
| |
Initial Admin Setup
After first install:
Command Reference
filebrowser
Start server with optional config.
Syntax:
| |
Options:
-c- Config file path (default:config.yaml)
Examples:
filebrowser setup
Create default configuration file.
Syntax:
| |
Output: Creates config.yaml in current directory.
filebrowser version
Display version information.
Syntax:
| |
Output (v1.5.x stable and v2.x beta):
filebrowser user set
Create or update a password-authenticated user.
Syntax:
| |
Options:
--password- Password (inline value, TTY prompt when omitted, or read from stdin when piped)-a/--admin- Grant admin permissions-c/--config- Config file path--no-input- Disable interactive prompts (fail if password value is required)
Examples:
filebrowser user promote
Grant admin permissions without changing the password.
Syntax:
| |
Example:
| |
filebrowser set (deprecated user syntax)
Deprecated user syntax (prints stderr warning):
| |
Use user set instead. This form remains available in v2.0.0 for compatibility.
filebrowser set rule
Syntax:
| |
Access Rule Options:
-s/--source- Source name from config (required)-p/--path- Index path (required)-r/--role- Rule category:user,group, orall(for deny only) (required)-v/--value- Username or groupname (required when-risuserorgroup)--allow- Allow access (default: false, which means deny)-c/--config- Config file path
Access Rule Examples:
| |
Troubleshooting
For common issues and solutions, see the Troubleshooting guide.