How to Access Server Files in a Web Browser with filebrowser

by

Hey there! Some links on this page may be affiliate links which means that, if you choose to make a purchase, I may earn a small commission at no extra cost to you. I greatly appreciate your support!

In this tutorial, you will learn how to install filebrowser which will allow you to access your website files and server files from right within a web browser. No need for an FTP client. With this file manager, you’ll be able to upload, download, edit, and delete files.

The only prerequisite is that you have SSH access to a Unix web server. Here are instructions for Mac and Windows.

How to Install filebrowser

In a terminal window, execute the following.

curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash

That’s it for installation!

Testing filebrowser

In order to test out filebrowser on your system, you can execute the following command.

filebrowser -p 8080 -a 134.122.27.34 -r /path/to/your/files

Where:

  • -p is the port to listen on
  • -a is the IP address to listen on
  • -r is the root directory that you’d like to serve. In most cases on Unix, this is /var/www/html/

You can find a full list of configuration options here.

Login screen for filebrowserPin

In a web browser, you can go to your IP address or domain name with the port that you specified. The default credentials are as follows.

  • Username: admin
  • Password: admin

How to Configure filebrowser

In order to have a more permanent solution for filebrowser, we will load it from the /etc/ directory where there will be two relevant files.

  • filebrowser.db: the local filesystem database file that is created when filebrowser first runs
  • filebrowser.json: a configuration file specifying the command line options from above and more

Since the database is automatically created for us, let’s create a file in the /etc/ directory called filebrowser.json. Feel free to put this anywhere on your system or call it whatever you’d like.

{
  "port": 8080,
  "baseURL": "",
  "address": "134.122.27.34",
  "log": "stdout",
  "database": "/etc/filebrowser.db",
  "root": "/var/www/"
}

Please update the configuration file with values that are appropriate for your system.

Now, you can bring up filebrowser with the following command, specifying the config file this time.

filebrowser -c /etc/filebrowser.json

How to Run filebrowser on Boot

Let’s make a system daemon to startup filebrowser when the system starts up. These instructions were written with an Ubuntu operating systems in mind.

Create the following file at /etc/systemd/system/filebrowser.service

[Unit]
Description=File Browser
After=network.target

[Service]
ExecStart=/usr/local/bin/filebrowser -c /etc/filebrowser.json

[Install]
WantedBy=multi-user.target

To enable and start the filebrowser service, run the following commands.

systemctl enable filebrowser.service
systemctl start filebrowser.service

Now, everytime that your system boots, so will filebrowser based on the options in your configuration file.

How to Install an SSL Certificate for filebrowser

Here is a video that shows you how to install an SSL certificate for filebrowser. This will allow you to access your files securely over HTTPS.

YouTube video


Meet Tony

With a strong software engineering background, Tony is determined to demystify the web. Discover why Tony quit his job to pursue this mission. You can join the Tony Teaches Tech community here.

Leave a Comment