🔒 Setup PrivateBin — Self-Hosted Zero-Knowledge Encrypted Pastebin
Deploy PrivateBin on Ubuntu with Docker — a minimalist, zero-knowledge encrypted pastebin where the server never sees your content. AES-256-GCM client-side encryption, burn-after-reading, expiry timers, and syntax highlighting.
📦 Resources & Setup Scripts
Before starting, please make sure to grab the required scripts from our GitHub repository.
Quick Install:
wget https://raw.githubusercontent.com/mhmdali94/Docker/refs/heads/main/tools/privatebin/privatebin-ubuntu.sh
chmod +x privatebin-ubuntu.sh
sudo bash privatebin-ubuntu.sh
Tutorial Steps
1 Download the Script
wget https://raw.githubusercontent.com/mhmdali94/Docker/refs/heads/main/tools/privatebin/privatebin-ubuntu.sh
2 Make it Executable
chmod +x privatebin-ubuntu.sh
3 Run the Installer
The script installs Docker, creates a persistent data volume at /opt/privatebin/data, and starts the PrivateBin container (privatebin/nginx-fpm-alpine) with port 8080 mapped to container port 8080 and the data directory bind-mounted for persistence.
sudo bash privatebin-ubuntu.sh
4 Access the Web UI
Open your browser and navigate to the PrivateBin interface:
http://<your-server-ip>:8080
Ports Used
| Port | Purpose |
|---|---|
| 8080 | PrivateBin Web UI |
Overview
PrivateBin is a minimalist, open-source, zero-knowledge encrypted pastebin. The defining principle is that the server never has access to the content of pastes — all encryption and decryption happens in the browser using AES-256-GCM. The symmetric encryption key is stored only in the URL fragment (#key) which browsers never send to the server. This means even if the server is compromised, the paste content remains unreadable. PrivateBin requires no database by default — it stores encrypted paste blobs as flat files in the data/ directory. Features include burn-after-reading, configurable expiry (5 minutes to 1 year), syntax highlighting via Prettify, Markdown rendering, password protection, and discussion threads on pastes.
Why Use It
Pastebin.com, GitHub Gist, and similar public paste services store your content in plaintext on their servers — anyone with the URL can read it, and the service provider can scan content. PrivateBin ensures that even you as the server operator cannot read paste content without the key. For sharing sensitive configuration snippets, API keys during onboarding, temporary credentials, or private text with clients, zero-knowledge encryption provides a fundamentally stronger privacy guarantee than any server-access-controlled alternative.
When You Need It
Who Should Use It
Real Use Cases
Main Features
How to Use After Installation
Security Best Practices
Ports and Firewall Notes
PrivateBin uses port 8080. For production, always serve over HTTPS via Nginx Proxy Manager — sharing paste URLs over plain HTTP exposes the encrypted ciphertext in transit (though not the key, the ciphertext should stay private). Restrict direct port 8080 access with ufw and only expose via the HTTPS reverse proxy.
Backup and Maintenance
Common Mistakes
Troubleshooting
Alternatives
Hastebin is a simpler, non-encrypted pastebin for quick text sharing without privacy requirements. Pasty is a modern alternative with API support. For file sharing (not just text), Pingvin Share or SFTPGo provide file drop functionality. CryptPad provides zero-knowledge encrypted collaborative editing for more complex documents beyond single pastes.
When Not to Use It
PrivateBin is not a file sharing tool — it is limited to text pastes. For sharing binary files, use Pingvin Share or similar. PrivateBin's burn-after-reading is not suitable for content that needs to be accessed multiple times. The zero-knowledge model means if the sender loses the URL, the content cannot be recovered from the server — it is truly inaccessible without the key fragment.
Frequently Asked Questions
What does zero-knowledge mean in PrivateBin?
Zero-knowledge means the server never sees the unencrypted content. Encryption uses AES-256-GCM in the browser. The key lives only in the URL fragment (#key) which browsers never send to the server — only the person with the full URL can decrypt the paste.
Can PrivateBin burn pastes after reading?
Yes. Enable burn-after-reading when creating a paste — the paste is permanently deleted from the server after the first person opens the decryption URL.
What port does PrivateBin use?
PrivateBin listens on port 8080. Use Nginx Proxy Manager with HTTPS for production — always serve paste URLs over HTTPS.
Does PrivateBin require a database?
No. PrivateBin stores encrypted pastes as flat files in data/ by default. No database or external services needed — the Docker volume is the only persistent storage required.
Can PrivateBin store pastes in a database?
Yes. PrivateBin supports MySQL/MariaDB, PostgreSQL, and Google Cloud Storage backends in addition to the default filesystem storage. Configure the backend in conf.php inside the container.
