Skip to content

pawanxcaliber/File-Server

Repository files navigation

Dockerized File Server

1. Why This Project?

This project provides a simple, web-based file server designed for convenient access to your files across different operating system partitions (Linux and Windows) from any device on your local network. The motivation includes seamless Browse, downloading, and managing files from both Linux home directories and your Windows C: drive without manual copying or shared folder complexities. It offers convenience by allowing access from any device on the same local network via a web browser. Docker containerization ensures easy setup, consistency, and portability by running in an isolated environment, preventing conflicts and allowing easy migration to other Linux systems with Docker.

2. Features

This file server offers a web-based interface for Browse directories and files. It provides direct access to specified Linux user directories, such as "Downloads" and "Documents". You can also access your mounted Windows partition, like the C: drive, directly. The server includes search functionality for finding files and folders, and allows for file uploads to the current directory. Basic authentication is handled via environment variables.

Screenshot of the GUI: image

3. Prerequisites

Before starting, ensure you have:

  • A Linux Operating System (e.g., Linux Mint).

  • Docker and Docker Compose installed. You can verify their installation by running docker --version and docker-compose --version.

  • Your Windows partition must be manually mounted (e.g., by clicking it in your file manager) before running the setup script.

  • Your application files (app.py, templates/ folder, Dockerfile) must be in the project's root directory.

4. Project Structure

Your project directory, which seems to be my_custom_file_server based on your ls -l output, should contain the following files:

  • app.py: Your Flask application logic.

  • templates/: Directory containing HTML templates for the web interface.

  • Dockerfile: Instructions to build the Docker image for your application.

  • start_file_server.sh: The main script to set up and run the server.

  • docker-compose.yml: (This file is generated by start_file_server.sh from a template).

  • file-server.desktop: Your desktop launcher file for Linux Mint.

  • my_custom_file_server_image.tar.gz: This appears to be a Docker image archive, possibly for sharing or backup.

5. Setup and Running the File Server

5.1. Place Your Application Files

Ensure app.py, the templates folder, and your Dockerfile are located directly inside your my_custom_file_server directory.

5.2. Identify Your Windows Partition UUID

  1. Mount your Windows partition manually (e.g., by clicking on it in your file manager).

  2. Open a terminal and run sudo blkid -o full.

  3. Look for your NTFS partition and copy its UUID (e.g., 6840D17A40D150042).

5.3. Configure the Start Script (start_file_server.sh)

Open the start_file_server.sh file and update the WINDOWS_PARTITION_UUID variable with the UUID you just identified.

5.4. Make the Start Script Executable

Open your terminal, navigate to your project directory (e.g., cd ~/Documents/Personal\ Project/my_custom_file_server/), and run chmod +x start_file_server.sh.

5.5. Run the File Server

Ensure your Windows partition is mounted (via your file manager), then from your project directory, execute the script:

Bash

./start_file_server.sh

The output will show the script finding the Windows partition, generating docker-compose.yml, ensuring no previous container is running, and then bringing up the Docker container. You will see messages like "Windows partition found mounted at: /media/pawan/6840D17A40D150042", and "Container my_custom_file_server Started".

6. Accessing the File Server

  1. Find your laptop's IP address by running ip a or hostname -I in a terminal.

  2. Open a web browser on any device on the same network.

  3. Navigate to http://YOUR_LAPTOP_IP:5000 (replace YOUR_LAPTOP_IP with your actual IP address).

You should see the file server interface with options like host_linux_home and host_windows_c.

7. Stopping the File Server

To stop and remove the Docker container and its network, open a terminal in your project directory and run:

Bash

docker-compose down

8. Creating a Desktop Launcher (Linux Mint)

To easily launch your server from the Linux Mint application drawer:

  1. Create a file named file-server.desktop in ~/.local/share/applications/.

  2. Paste the following content into file-server.desktop:

    [Desktop Entry] Name=My File Server Comment=Start the Dockerized File Server Exec=gnome-terminal -- bash -c "/home/pawan/Documents/Personal\\ Project/my_custom_file_server/start_file_server.sh; echo; echo 'Press ENTER to exit'; read" Path=/home/pawan/Documents/Personal Project/my_custom_file_server Icon=utilities-terminal Terminal=false Type=Application Categories=Development;Network;Web; StartupNotify=true

  3. Make the file-server.desktop file executable using chmod +x ~/.local/share/applications/file-server.desktop.

  4. To refresh your desktop environment and make the launcher appear, log out and log back into your Linux session, or run cinnamon --replace in a terminal if you're using the Cinnamon desktop.

9. Security Considerations

This setup is primarily for local network use and has security implications:

  • Hardcoded Credentials: The FLASK_SECRET_KEY and ADMIN_PASSWORD_HASH are hardcoded in the Docker Compose template. You must change these to strong, unique values, especially for production or publicly accessible environments.

  • No HTTPS: The server uses HTTP (port 5000) by default, meaning data is unencrypted. Do not expose it to the public internet without implementing HTTPS.

  • Local Network Only: The server is only accessible on your local network. Avoid router port forwarding to the internet without robust security.

  • Basic Authentication: The current authentication is very basic and not suitable for multi-user or high-security scenarios.

10. Troubleshooting Common Issues

  • "Windows partition with UUID '...' is not currently mounted.": Ensure your Windows partition is manually mounted via your file manager before running the script.

  • "unknown flag: --remove-orphans" or "unknown shorthand flag: 'd' in -d": This often means an older Docker Compose version. The script uses docker-compose (with hyphen) for compatibility. Ensure your Docker Compose is updated if issues persist.

  • "Error launching the application" from Desktop Launcher: Verify file-server.desktop has executable permissions (chmod +x), then log out/in or restart your desktop environment (cinnamon --replace).

  • File server not accessible: Check your laptop's IP, confirm the Docker container is running (docker ps), and ensure no firewall is blocking port 5000 (e.g., sudo ufw allow 5000/tcp).

  • "No items found in this directory. Check BASE_MOUNT_POINTS_IN_CONTAINER configuration.": This suggests issues with Docker's access to host paths. Re-run start_file_server.sh to regenerate docker-compose.yml and ensure the host paths are correctly mounted and accessible.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published