Disclaimer: All the methods given here are meant to be used within a secure local area network. Since these methods doesn’t have any security mechanism, it is not recommended to use them in production. You have been warned!
Method 1 – Using simpleHTTPserver (Python)
We already have written a brief guide to setup a simple http server to share files and directories instantly in the following link. If you have a system with Python installed, this method is quite handy.
Method 2 – Using Quickserve (Python)
This method is specifically for Arch Linux and its variants. Check the following link for more details.
Method 3 – Using Ruby
In this method, we use Ruby to serve files and folders over HTTP in Unix-like systems. Install Ruby and Rails as described in the following link.
Once Ruby installed, go to the directory, for example ostechnix, that you want to share over the network:
And, run the following command:
Make sure the port 8000 is opened in your router or firewall . If the port has already been used by some other services use different port.
You can now access the contents of this folder from any remote system using URL – http://<IP-address>:8000/.
To stop sharing press CTRL+C.
Method 4 – Using Http-server (NodeJS)
Http-server is a simple, production ready command line http-server written in NodeJS. It requires zero configuration and can be used to instantly share files and directories via web browser.
Install NodeJS as described below.
Once NodeJS installed, run the following command to install http-server.
Now, go to any directory and share its contents over HTTP as shown below.
Now, you can access the contents of this directory from local or remote systems in the network using URL – http://<ip-address>:8000.
To stop sharing, press CTRL+C.
Method 5 – Using Miniserve (Rust)
Miniserve is yet another command line utility that allows you to quickly serve files over HTTP. It is very fast, easy-to-use, and cross-platform utility written in Rust programming language. Unlike the above utilities/methods, it provides authentication support, so you can setup username and password to the shares.
Install Rust in your Linux system as described in the following link.
After installing Rust, run the following command to install miniserve:
Alternatively, you can download the binaries from the releases page and make it executable.
And, then you can run it using command (assuming miniserve binary file is downloaded in the current working directory):
Usage
To serve a directory:
Example:
Now, you can access the share from local system itself using URL – http://localhost:8080 and/or from remote system with URL – http://<ip-address>:8080.
To serve a single file:
Example:
Serve file/folder with username and password:
Bind to multiple interfaces:
As you can see, I have given only 5 methods. But, there are few more methods given in the link attached at the end of this guide. Go and test them as well. Also, bookmark and revisit it from time to time to check if there are any new additions to the list in future.
And, that’s all for now. Hope this was useful. More good stuffs to come. Stay tuned!
Cheers!
No comments:
Post a Comment