How to Share Files on the Internet Using Your Local Machine (For Users with Shared IPs)

If you're living in a developing country like Bangladesh, chances are you're using a shared IP connection. While shared IPs are cost-effective and provide decent internet speeds, they come with a significant limitation: the inability to share files directly over the internet. This is because shared IPs often use private IP addresses, which are not routable on the public internet.

In this guide, you'll learn a straightforward method to host and share files from your local machine, even if you're on a shared or private IP. This method is compatible with Linux, and the same steps can be followed with minor adjustments for Windows and macOS.

Step-by-Step Guide

1. Update Your System

Before setting up your file-sharing server, it's essential to ensure that your system is up to date. Open your terminal and run the following command:

#For debain based destro
sudo apt update && sudo apt upgrade

2. Install Cloudflared

Cloudflared is a tool by Cloudflare that allows you to create secure tunnels to your localhost. This will enable you to expose your local server to the internet securely.

Visit the official Cloudflare documentation to download the correct version for your system:
Download Cloudflared

Follow the instructions provided on the page to install it properly.

3. Ensure Python is Installed

Python is required to start a simple HTTP server from your machine. If Python is not already installed, you can download and install it from the official Python website:
Download Python

4. Navigate to the Folder You Want to Share

Use the terminal to go to the directory that contains the files you wish to share. For example:

cd ~/Documents/myfiles

5. Start a Simple HTTP Server

Once you're in the desired directory, start a local HTTP server using Python:

python3 -m http.server 8080

This command will start a server on port 8080, making the files in the directory accessible locally.

6. Create a Public Tunnel Using Cloudflared

Now it's time to make your local server accessible on the internet. In a new terminal window, run:

cloudflared tunnel --url http://localhost:8080

After running the above command, Cloudflared will generate a unique, publicly accessible URL. You can share this link with anyone, and they will be able to access the files hosted on your local server.

Conclusion

With just a few simple steps, you can overcome the limitations of a shared IP and share files directly from your local machine using Cloudflared and Python. This method is fast, secure, and requires minimal setup—perfect for users in countries where internet infrastructure may not support static or public IP addresses.

Whether you're on Linux, Windows, or macOS, this technique empowers you to share resources efficiently without needing to invest in expensive infrastructure.

FAQs

1. Can I use this method on Windows or macOS?
Yes, the same steps can be followed with minimal changes specific to each operating system.

2. Is the shared link permanent?
No, the link generated by Cloudflared is temporary and changes each time you run the command. You can create an account on Cloudflare to make the link permanent.

3. Can I password-protect the shared files?
Not directly via this method. For advanced security, consider using other web server configurations or file-sharing platforms.

4. Is this method secure?
Cloudflared provides a secure tunnel, but it's still recommended not to share sensitive or personal data unless necessary.

5. Do I need a Cloudflare account?
No, this method works without requiring a Cloudflare account.

0
Subscribe to my newsletter

Read articles from Md Sakib Sadman Badhon directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Md Sakib Sadman Badhon
Md Sakib Sadman Badhon

Hello, I am Badhon. I tend to forget things easily which is why I opened this blog.