[root tip] [How To] Easy on-demand filesharing

Filesharing

To instantly share files on the network - only one thing is required - a caddy.

Install the package from the official repo.

sudo pacman -S caddy

Copy the files you want to share to the Public folder in your home (Public is the english name - localized versions will most likely work as well) - and remember to surround folder path with double quotes if there’s a space in the name.

Then run this command (you can of course script it)

caddy file-server --root "/home/$USER/Public Files" --listen :8080 --browse

Open a browser on any computer connected to your network and enter

http://hostname:8080

Or

http://hostip:8080

You are of course not limited to use the Public folder - in fact it could be any folder that makes sense - just change the –root argument to match.

Also remember to use a non-priviledged port - that is any port between 1024 and 65535.

Screenshots

Browse locally

From any computer on your local network

Using hostname

20211013-084831_642x398_screenshot

Using IP

20211013-085305_615x362_screenshot

8 Likes

Hello @linux-aarhus,

thank you for share this. I have tested caddy and this works fine.

I also found an likewise method to do the same using python in an linux magazine. Python has also an build-in http-server.

You can run it with this command:

python -m http.server 4444

Which opens an http server on port 4444. The directory which is suppied by the server is the same directory were you run this command.
I have tested both solution with a 100MB file. At my point both solutions get the same speed.

4 Likes

Thanks, that’s really helpful.