Use Cases
- Remote server file management: Ideal for server administrators who need to access and manage files on a VPS or local server without using command-line tools like SSH.
- File sharing: Great for teams needing to share files securely with password-protected links or user-specific permissions.
- Personal cloud storage: Useful for creating a personal cloud to store and access documents, photos, or other files from anywhere.
- Automation and integration: Suitable for projects requiring web-based file access, with API support for integration.
Prerequisites
- A server with Docker and Docker Compose installed (e.g., Ubuntu, Debian, or other Linux system).
- Terminal access with administrator privileges (root or sudo).
- An open network port in the firewall (e.g., 4500).
- A non-root user on the server with UID and GID 1000 (e.g., myuser).
Step-by-step Installation
Step 1: Create the configuration directory
1. Create a directory on the server to store FileBrowser's configuration and database files:
Code:
sudo mkdir -p /app/filebrowser
2. Create the configuration file settings.json:
Code:
echo '{"branding":{"nome":"FileBrowser"},"root":"/srv","banco de dados":"/database/filebrowser.db","endereço":"0.0.0.0","porta":80}' | sudo tee /app/filebrowser/settings.json
3. Set the correct permissions for the user with UID/GID 1000:
Code:
sudo chown -R 1000:1000 /app/filebrowser
sudo chmod -R 770 /app/filebrowser
Why? FileBrowser runs as user 1000:1000 by default, and the directory needs read/write permissions.
Step 2: Create the docker-compose.yml file
1. Create a directory for the docker-compose.yml file (e.g., /home/myuser/docker/filebrowser):
Code:
mkdir -p /home/myuser/docker/filebrowser
nano /home/myuser/docker/filebrowser/docker-compose.yml
2. Add the following content:
- Explanation:
- image: Uses the latest version of FileBrowser.
- ports: Maps port 4500 on the host to port 80 in the container.
- PUID and PGID: Ensures FileBrowser runs as the user with UID/GID 1000.
- volumes: Maps the host’s /home directory to /srv (file directory), and /app/filebrowser to /database and /config (database and configuration).
3. Save the file and exit the editor (Ctrl+O, Enter, Ctrl+X in nano).
Step 3: Start the container
1. Navigate to the directory containing docker-compose.yml:
Code:
cd /home/myuser/docker/filebrowser
2. Start the container:
Code:
docker compose up -d
Why? The -d flag runs the container in the background.
Step 4: Configure the firewall
1. Allow port 4500 in the firewall to enable external access:
Code:
sudo ufw allow 4500
2. Check the firewall status:
Code:
sudo ufw status
Ensure 4500 ALLOW Anywhere appears in the output.
Step 5: Check logs and obtain the password
1. Check the container logs to confirm it’s running:
Code:
docker logs filebrowser
2. Look for a line like:
Code:
Use the following password to login: <your_random_password>
or
Admin user created with password: <your_random_password>
Note the generated password for the admin user.
Step 6: Access FileBrowser
- Open a browser and navigate to http://<SERVER_IP>:4500 (e.g., http://192.168.1.100:4500).
- Log in with:
- Username: admin
- Password: <your_random_password> (from the logs)
- After logging in, you can change the password or create new users in the web interface.
Step 7: Verify the container status
1. Confirm the container is running:
Code:
docker ps
The filebrowser container should appear with status Up and no (unhealthy) tag.
Troubleshooting
- Permission errors: Ensure /app/filebrowser has 770 permissions and is owned by 1000:1000 (sudo chown -R 1000:1000 /app/filebrowser).
- Page not accessible: Verify that port 4500 is open in the firewall and the container is listening on [::]:80 (check logs).
- Login error (403 Forbidden): Clear the database volume with docker volume rm filebrowser_data and restart the container to generate a new password.
- No password in logs: Stop the container, remove the volume (docker volume rm filebrowser_data), and restart with docker-compose up -d.