filebrowser — Linux
Sometimes it's nice to play with a filbrowser on a NAS. One nice small project is - filbrowser. I have a post about using it with docker, but this is how to set filebrowser up on Alpine/Ubuntu/Debian VM/CT
filebrowser is supported on Docker, Linux, macOS, and Windows. Previous post discussed how to run filebrowser in Docker, now it's all about Linux.
Alpine
The default is ash, not bash. Install bash and edit your user (not root) in /etc/passwd, then reboot for the change to take effect. Edit the get.sh.
Add bash and curl to an Alpine VM/CT
doas apk update && doas add curl bash⚠️ Alpines default shell is ash and the script uses bash.
doas nano /etc/passwdReboot the VM
Download
Download the script and make it executable
wget https://raw.githubusercontent.com/filebrowser/get/master/get.sh
doas chmod +x get.shEdit the get.sh
Edit the get.sh -script line 42 and change sudo → doas.
nano get.shNow install filebrowser on the VM by executing doas ./get.sh.
Initialize the config — option
filebrowser config initAdd a directory command
The directory you will control with filebrowser, e.g., /exports for a nfs NAS.
doas filebrowser -r /exportsfilebrowser -r /path/to/your/files
Add user
You can do it from the browser after login as admin or from CLI interface.
filebrowser users add <user> <password>Startup script
nano startFILEBROWSWER.shCreate the startFILEBROWSWER.sh script
startFILEBROWSWER.sh#!bin/bash
# Start filebrowser if Stopped
TARTED=`ps -s |grep 'filebrowser --port 8080' | wc -l`
# echo "$TARTED" # testing logic
if [ $TARTED -gt 1 ]; then
echo "running"
else
echo "Stopped - restarting..."
/usr/local/bin/filebrowser --port 8080 -a 192.0.2.40 -r /exports/
fistartFILEBROWSWER.sh
chmod 700 startFILEBROWSWER.sh
doas ./startFILEBROWSWER.shMake executable and start filebrowser

Ubuntu
Here's how to create a systemd service.
nano /etc/systemd/system/filebrowser.service
[Unit]
Description=Filebrowser
After=network-online.target
[Service]
User=root
Group=root
ExecStart=/usr/local/bin/filebrowser -r /exports
[Install]
WantedBy=multi-user.target
Start / Stop filebrowser service
- Reload: systemctl --user daemon-reload
- Start: systemctl start filebrowser
- Stop it: systemctl stop filebrowser
This method is safer than keeping it always running but needs the user to start filbrowser manually.
Run as a daemon ⚠️
- Keep it running: systemctl enable filebrowser
- Disable: systemctl disable filebrowser
LAN only: Only listening on a LAN is still a little dangerous.
Only start up filbrowser when you need it.
Start by script
This method is safer than keeping it always running but requires the user to start filbrowser manually.
You need to run the script as root or sudo.
nano startFILBROWSER.shMake it executable chmod 700 startFILEBROWSER.sh
# Start filebrowser if stopped
LOG="/root/filebrowser.log.`date +%d%m%Y`"
echo "Delete log files older than 7 days" >>$LOG
/usr/bin/find /root/filebrowser.log.* -type f -mtime +7 -exec rm -v {} \;
echo "Started `date`" >>$LOG
TARTED=`ps -s |grep 'filebrowser --port 80' | wc -l`
# echo "$TARTED" # testing logic
if [ $TARTED -gt 1 ]
then
echo "running"
else
echo "stopped"
/usr/local/bin/filebrowser --port 80 -a 192.0.2.50 -r /exports/
fi
echo "Stopped `date`" >>$LOGCreate the filbrowser.json file
Place the configuration file, filebrowser.json, in /etc/ or where you have the db.
nano /etc/filebrowser.json{
"port": 8080,
"baseURL": "",
"address": "192.0.2.22",
"log": "stdout",
"database": "/etc/filebrowser.db",
"root": "/var/www/html"
}In this example, both the db and the json are located in /etc
Upload files using SCP
Go to a directory you like to upload all files from and doscp *.* <user>192.0.2.80:/home/<user>/<directory>/
References
filebrowser [1] Note for Alpine [2]