How to Access Server Files in a Web Browser with file browser

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 instructionsfor 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 filebrowser 

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.

3 min read
Nov 23, 2024
By Md Real
Share

Leave a comment

Your email address will not be published. Required fields are marked *