File Browser is an elegant file browser and file manager for the web with the following features:
- Clear and simple interface
- Allows these operations over the files:
- Upload
- Download
- Delete
- Edit
- Preview
- User administration
- You can create multiple users and each user have their own directory
- Easy to install
Install
Download the binary executing:
$ curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash
In Alpine Linux you need to install BASH.
$ sudo apk add bash
Copy the binary to /usr/local/bin
$ sudo install filebrowser /usr/local/bin/
Start the File Browser
From the command line
All the files that you upload through File Browser will be stored in storage, it is also possible to use a DIR that already exists, for example a Web directory.
$ mkdir storage
Start:
$ nohup filebrowser -a IP -b / -p 8000 -r storage/&
The File Browser starts in the background, the advantage is that we can execute the previous command using a standard user, the disadvantage is that if you restart your device then you must execute the command again, therefore it is advisable to create a service to be able to manage and start it with the operating system.
As a service
Add user and group filebrowser using GNU user land
With the following command we create the user and group filebrowser (note the --group
option), the --system
option means that the user id will be lower than 1000 (ID assigned by default to system users in Debian/Ubuntu).
sudo adduser --system --group --HOME /var/lib/filebrowser/ --shell /usr/sbin/nologin --no-create-home filebrowser
Add user and group filebrowser using using BusyBox
$ sudo addgroup -S filebrowser
$ sudo adduser -S -s /sbin/nologin -H -h /var/lib/filebrowser -G filebrowser filebrowser
Where
- -S: Create a system user/group.
- -s: Login shell.
- -H: Don’t create home directory.
- -h: Home directory.
- -G: User group.
Create /var/lib/filebrowser directory
$ sudo mkdir -p /var/lib/filebrowser/storage
Change the owner
$ sudo chown -Rc filebrowser:filebrowser /var/lib/filebrowser
Create the configuration file
Create filebrowser directory
$ sudo mkdir /etc/filebrowser
Create the configuration file .filebrowser.toml
$ sudo touch /etc/filebrowser/.filebrowser.toml
Add the following options, check File Browser options for more details
address = "Put here your IP or URL"
port = 8080
root = "/var/lib/filebrowser/storage"
database = "/var/lib/filebrowser/filebrowser.db"
log = "/var/log/filebrowser.log"
Create log file
$ sudo touch /var/log/filebrowser.log
Change the owner
$ sudo chown -c filebrowser:filebrowser /var/log/filebrowser.log
Create systemd unit
Create the systemd unit with the following command
$ sudo systemctl edit --force --full filebrowser
add:
[Unit]
Description=Web File Browser
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/bin/filebrowser
User=filebrowser
Group=filebrowser
[Install]
WantedBy=multi-user.target
now we can:
Start
$ sudo systemctl start filebrowser
Stop
$ sudo systemctl stop filebrowser
Check status
$ sudo systemctl status filebrowser
Start with the OS
$ sudo systemctl enabled filebrowser
As OpenRC service
For more information check:
– Writing Init Scripts
– Manpages of openrc in Debian
– OpenRC Service Script Writing Guide
Create filebrowser file
$ sudo touch /etc/init.d/filebrowser
add:
#!/sbin/openrc-run
depend() {
need net
}
command="/usr/local/bin/filebrowser"
command_user="filebrowser:filebrowser"
pidfile="/run/${RC_SVCNAME}.pid"
command_background=true
assign exec perms:
$ sudo chmod -c 755 /etc/init.d/filebrowser
now we can:
Start
$ sudo rc-service filebrowser start
Stop
$ sudo rc-service filebrowser stop
Start with the OS
$ sudo rc-update add filebrowser default
Now you can access the your File Browser at http://YourIP:8080/, the default username and password are: admin/admin.