ServeFile – Share within a local network/LAN
Most computers based on the Linux operating system usually use Samba to share files within a local network. This is because it is easy to install and can share files with other PCs in the network, even if they have different operating systems. The problem arises when you want to share files with other devices such as smartphones or feature phones. Smartphone users need to install an app that supports Samba, as the default file explorer or built-in apps do not support Samba.
To share files with almost any device that has a browser, you can install SimpleHTTPServer Python or HTTP-server Node.js. However, SimpleHTTPServer Python is slow, while HTTP-server Node.js requires Node.js to be installed first.
ServeFile addresses this need. It is easy to install and can share files through an HTTP server on port 8080 (unless you change the default port). The data transfer speed is quite fast, depending on the network cable and local network conditions.
Installation
Installation method, make sure Python is already installed by typing the command
sudo apt install python3-pip
Then install ServeFile with the command
pip install servefile
Usage
Example of using ServeFile to display files in the “Public” folder:
python3 -m servefile -l ~/Public
The command will list the files in the ‘Public’ folder. The following message will appear if successful:
If you access http://192.168.122.85:8080/ (192.168.122.85 is the IP address at my place, it might be different at your place depending on your local network IP settings) through a browser, you will see a link to download the files in the folder as follows
Servefile also records activities when the file is accessed or downloaded.
To stop servefile, press Ctrl + C.
Conclusion
With servefile, sharing files within a local network is quite easy. However, this is not for sharing files between PCs like Samba, which can share files in a folder. In servefile, the client computer can only download data, not edit or change data in the folder shared by the server/