Replacing ShareX with Flameshot + VPS for Private Image Uploads on Linux

Introduction

If you’ve used ShareX for taking screenshots and uploading them, you might have noticed a big privacy concern—many image hosts (like Imgur) are public by default, and anyone with the link can access your images.

But what if you could host your own image uploads securely, with full control, right from your Linux system?

This guide will walk you through setting up Flameshot + VPS for private image uploads, so you get ShareX-like functionality but with total privacy.


🔹 What You’ll Need

Before we start, make sure you have:

Linux Mint (or any Linux distro) – We’re using Linux Mint Cinnamon for this guide.
Flameshot – A powerful screenshot tool.
A VPS (Virtual Private Server) – To store your images privately.
Basic command-line knowledge – To set up the script.

🔹 Step 1: Setting Up Your VPS for Image Uploads

Since we want full control, we’ll store our screenshots on a VPS instead of Imgur.

🔹 Step 1: Setting Up Your VPS for Image Uploads

Since we want full control, we’ll store our screenshots on a VPS instead of Imgur.

1️⃣ Create an Upload Directory

SSH into your VPS and create a folder for uploads:

mkdir -p /var/www/html/screenshot/public
chmod -R 775 /var/www/html/screenshot/public
chown -R www-data:www-data /var/www/html/screenshot/public

2️⃣ Create the PHP Upload Script

Create a file upload.php inside /var/www/html/screenshot/:

<?php
$address = "http://your-vps-ip/screenshot/public/";
$secret_key = "YOUR_SECRET_KEY"; // Change this to a strong password

if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['image']) && isset($_POST['key'])) {
    if ($_POST['key'] !== $secret_key) {
        die("Unauthorized.");
    }

    $uploadDir = __DIR__ . "/public/";
    $extension = pathinfo($_FILES['image']['name'], PATHINFO_EXTENSION);
    if (!$extension) $extension = "png";

    $fileName = time() . "_" . uniqid() . "." . $extension;
    $targetPath = $uploadDir . $fileName;

    if (move_uploaded_file($_FILES['image']['tmp_name'], $targetPath)) {
        echo "$address$fileName";
    } else {
        echo "Upload failed.";
    }
} else {
    echo "Invalid request.";
}
?>

3️⃣ Test the Upload Script

On your local machine, try uploading a test image:

curl -F "image=@screenshot.png" -F "key=YOUR_SECRET_KEY" http://your-vps-ip/screenshot/upload.php

If it returns a URL, you’re all set! 🎉


🔹 Step 2: Automating Flameshot to Upload Screenshots

Now, let’s configure Flameshot to automatically upload screenshots to our VPS and copy the link to the clipboard.

1️⃣ Create the Upload Script

Create a new script:

nano ~/flameshot_upload.sh

Paste the following:

#!/bin/bash

# Capture screenshot and upload to VPS
URL=$(flameshot gui -r | curl -s -F "image=@-" -F "key=YOUR_SECRET_KEY" http://your-vps-ip/screenshot/upload.php)

# Copy the URL to clipboard and notify the user
if [[ $URL == *"http"* ]]; then
    echo -n "$URL" | xclip -selection clipboard  # Use wl-copy if on Wayland
    notify-send "Upload Complete" "URL copied: $URL"
else
    notify-send "Upload Failed" "$URL"
fi

Save and make it executable:

chmod +x ~/flameshot_upload.sh

Now, running ~/flameshot_upload.sh will: ✅ Let you select an area with Flameshot.
Upload the screenshot to your VPS.
Copy the URL to your clipboard.
Show a desktop notification when done.


🔹 Step 3: Creating a Custom Keyboard Shortcut

To make this process seamless, let’s bind it to a hotkey (Win + Shift + U) in Linux Mint Cinnamon.

1️⃣ Open Keyboard Shortcuts in Cinnamon

  • Open “System Settings”“Keyboard”“Shortcuts”
  • Click “Add custom shortcut”
  • Name: Flameshot Auto-Upload
  • Command: ~/flameshot_upload.sh
  • Click “Add”

2️⃣ Assign a Keyboard Shortcut

  • Find Flameshot Auto-Upload in the list.
  • Click “Unassigned” and press Win + Shift + U.
  • Click “Apply”.

Now, pressing Win + Shift + U will:

  • Open Flameshot to select an area.
  • Upload the screenshot to your VPS.
  • Copy the image URL automatically.
  • Notify you when the upload is done.

🔥 No need to manually open the terminal anymore! 🔥


🔹 Final Thoughts

Now you have a fully private, self-hosted image uploader that replaces ShareX!

FeatureShareXFlameshot + VPS
Privacy❌ Public by default✅ Private VPS storage
Direct Links✅ Yes✅ Yes
Clipboard Auto-Copy✅ Yes✅ Yes
Keyboard Shortcut✅ Yes✅ Yes
Third-Party Hosting?❌ Uses Imgur✅ Your VPS

🚀 Now, every time you screenshot, your image is privately stored and instantly copied to your clipboard!

 

error: Content is protected !!