This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| computing:filebrowser [2025/12/09 04:45] – oemb1905 | computing:filebrowser [2025/12/13 06:18] (current) – oemb1905 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ------------------------------------------- | ------------------------------------------- | ||
| - | * **Navidrome Setup** | + | * **Setting up a secure & public-facing Filebrowser instance** |
| * **oemb1905** | * **oemb1905** | ||
| * **filebrowser-pub** | * **filebrowser-pub** | ||
| Line 11: | Line 11: | ||
| ------------------------------------------- | ------------------------------------------- | ||
| - | This tutorial is for Debian Trixie users seeking to set up a secure and public-facing Filebrowser instance. This is to assist with uploading and managing music/media on Navidrome, Jellyfin, and other similar instances. | + | This tutorial is for Debian Trixie users seeking to set up a secure and public-facing |
| - | 1. Install File Browser (latest) | + | curl -fsSL https:// |
| - | | + | sudo mkdir -p / |
| - | curl -fsSL https:// | + | sudo chown -R filebrowser:filebrowser / |
| - | ``` | + | sudo chmod 755 / |
| - | change the admin user's password: | + | adduser navidrome filebrowser |
| + | adduser jellyfin filebrowser | ||
| - | sudo systemctl stop filebrowser | + | The system will give you an auto-generated user and password |
| - | sudo filebrowser users update admin --password | + | |
| - | sudo systemctl start filebrowser | + | |
| - | this is not changing the user filebrowser's password, but rather the admin user's password in the var-based db | + | sudo systemctl stop filebrowser |
| + | sudo filebrowser users update | ||
| + | sudo systemctl start filebrowser | ||
| + | Make sure to pick a 16+ character password; this is public facing. To be clear, this is invoking the '' | ||
| - | 2. Create system user | ||
| - | | ||
| sudo adduser --system --group --no-create-home filebrowser | sudo adduser --system --group --no-create-home filebrowser | ||
| - | ``` | ||
| - | 3. Install ACL tools | + | Once the dedicated user is created, let's create the systemd unit to control starting/ |
| - | | + | |
| - | sudo apt install acl | + | |
| - | ``` | + | |
| - | 4. Systemd unit (final working version) | + | <code bash> |
| - | `/ | + | [Unit] |
| - | | + | Description=File Browser |
| - | [Unit] | + | After=network.target |
| - | | + | |
| - | | + | |
| - | [Service] | + | [Service] |
| - | | + | User=filebrowser |
| - | | + | Group=filebrowser |
| - | | + | WorkingDirectory=/ |
| - | | + | ExecStart=/ |
| - | | + | --address 127.0.0.1 \ |
| - | | + | --port 8080 \ |
| - | | + | --root / |
| - | | + | --database / |
| - | | + | Restart=always |
| - | | + | RestartSec=5 |
| - | [Install] | + | [Install] |
| - | | + | WantedBy=multi-user.target |
| - | ``` | + | </ |
| - | | + | |
| - | sudo systemctl daemon-reload | + | |
| - | sudo systemctl enable --now filebrowser | + | |
| - | ``` | + | |
| - | 5. Give File Browser permanent write access to the existing Navidrome library | + | Once that's in place, load the unit and start the service: |
| - | | + | |
| - | sudo setfacl -R -m u: | + | |
| - | sudo setfacl -R -m d: | + | |
| - | ``` | + | |
| - | 6. Apache reverse-proxy vhosts (already present) | + | sudo systemctl daemon-reload |
| + | sudo systemctl enable --now filebrowser | ||
| - | HTTP → HTTPS redirect | + | Make sure to customize the unit file for your own use-case. For example, you might have a different startup directory, different listening port, and so on. Once the unit file is created and the service has started, let's make sure that ACL is installed so we can set a custom rule for the filebrowser UNIX user, which the filebrowser' |
| - | `nano /etc/apache2/sites-available/upload.gnulinux.studio.conf` | + | |
| - | ```apache | + | sudo apt install acl |
| - | < | + | sudo setfacl -R -m u: |
| - | | + | sudo setfacl |
| - | RewriteEngine On | + | |
| - | | + | UPDATE: This is actually overkill. You can simply: |
| - | </ | + | sudo chown -R filebrowser:navidrome |
| - | ``` | + | |
| + | Bear in mind, however, that new files will be owned by filebrowser: | ||
| - | HTTPS reverse proxy | + | This assumes '' |
| - | | + | |
| - | | + | |
| - | < | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | sudo apt install certbot letsencrypt python3-certbot-apache |
| - | ProxyPass / http://127.0.0.1: | + | sudo certbot --authenticator standalone --installer apache -d domain.com --pre-hook " |
| - | | + | |
| - | | + | This will create another virtual host at '' |
| - | | + | |
| - | | + | |
| - | | + | |
| - | </VirtualHost> | + | |
| - | ``` | + | |
| - | Done. | + | <code bash> |
| - | https://upload.gnulinux.studio | + | < |
| - | Everything appears and plays instantly. | + | ServerName |
| + | RewriteEngine On | ||
| + | RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301] | ||
| + | </VirtualHost> | ||
| + | </ | ||
| - | ### One-page note to yourself (for the other Navidrome thread) | + | Now, let's do the same trick with the https virtual host. Open up '' |
| - | This entire setup lives on the **exact same VM** `gnulinux.studio` that already runs Navidrome | + | <code bash> |
| + | < | ||
| + | ServerName upload.gnulinux.studio | ||
| + | SSLEngine | ||
| + | SSLCertificateFile | ||
| + | SSLCertificateKeyFile | ||
| - | - Navidrome is reachable at https:// | + | ProxyPreserveHost On |
| - | - File Browser is reachable at https://upload.gnulinux.studio (separate Apache vhost, same Let’s Encrypt cert) | + | ProxyPass |
| - | - File Browser’s `--root` points directly at `/opt/ | + | |
| - | - Write access for the `filebrowser` system user is granted **exclusively** by two ACL commands: | + | |
| - | ```bash | + | |
| - | setfacl -R -m u: | + | |
| - | setfacl -R -m d:u: | + | |
| - | ``` | + | |
| - | No group membership, no setgid, no cron required for functionality. | + | |
| - | - Navidrome continues to own most files and always has group `navidrome`, | + | |
| - | - File Browser creates files as `filebrowser:navidrome` (group inheritance) → Navidrome plays them instantly. | + | |
| - | --- // | + | RewriteEngine On |
| + | RewriteCond %{HTTP: | ||
| + | RewriteCond %{HTTP: | ||
| + | RewriteRule ^/?(.*) ws:// | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | Once this is done, you should be good to go. Make sure that: | ||
| + | |||
| + | * If you already using domain.com, then change the above to sub.domain.com | ||
| + | * LAMP stack won't work unless all modules, headers, and mpm_event/ | ||
| + | * Have fail2ban configured | ||
| + | |||
| + | This tutorial is not designed to provide a full tutorial on these topics, but generally these modules are enough: | ||
| + | |||
| + | sudo a2enmod ssl | ||
| + | sudo a2enmod proxy | ||
| + | sudo a2enmod proxy_http | ||
| + | sudo a2enmod proxy_wstunnel | ||
| + | sudo a2enmod headers | ||
| + | sudo a2enmod rewrite | ||
| + | sudo a2enmod remoteip | ||
| + | sudo a2enmod proxy_fcgi | ||
| + | sudo a2enmod setenvif | ||
| + | |||
| + | If you need more guidance, see the Apache Survival Tutorial already linked at the top. If you need help with mpm_event and fpm, use my [[https:// | ||
| + | |||
| + | <code bash> | ||
| + | [filebrowser] | ||
| + | enabled = true | ||
| + | backend = systemd | ||
| + | port = 8080 | ||
| + | filter = filebrowser | ||
| + | logpath = / | ||
| + | maxretry = 3 | ||
| + | findtime = 600 | ||
| + | bantime = 3600 | ||
| + | action = iptables-allports[name=filebrowser] | ||
| + | </ | ||
| + | |||
| + | After the jail is established, | ||
| + | |||
| + | <code bash> | ||
| + | [INCLUDES] | ||
| + | before = common.conf | ||
| + | [Definition] | ||
| + | datepattern = ^%%Y/ | ||
| + | failregex = /api/login: 403 < | ||
| + | ignoreregex = | ||
| + | </ | ||
| + | |||
| + | Make sure to adjust bantime, maxretry, and findtime to your preferences. Also, apache-auth' | ||
| + | |||
| + | <code bash> | ||
| + | [apache-auth] | ||
| + | enabled = true | ||
| + | port = http, | ||
| + | filter = apache-auth | ||
| + | logpath = / | ||
| + | maxretry = 5 | ||
| + | findtime = 600 | ||
| + | bantime = 3600 | ||
| + | action = iptables-allports[name=apache-auth] | ||
| + | </ | ||
| + | |||
| + | Now, for the filter, let's open ''/ | ||
| + | |||
| + | <code bash> | ||
| + | [Definition] | ||
| + | failregex = ^< | ||
| + | ^< | ||
| + | ignoreregex = | ||
| + | </ | ||
| + | |||
| + | This creates a separate jail for common errors brute-forcers will receive when they are trying to access your instance' | ||
| + | |||
| + | Happy Hacking !!! | ||
| + | |||
| + | --- // | ||