Remove Forgotten PDF Passwords on Ubuntu/Linux

Краткое содержание

Pixel shares a step-by-step guide to handling forgotten PDF passwords on Ubuntu and Linux. It explains the difference between open and owner passwords and covers tools including qpdf, John the Ripper, pdf2john, PDFtk, and Poppler utilities for inspecting and unlocking your own documents.

DEV Community

How to Remove Forgotten PDF Password Protection in Ubuntu/Linux

How to Remove Forgotten PDF Password Protection in Ubuntu/Linux Getting locked out of your own important PDF document is frustrating—especially when you need to print, edit, or extract data from it right away. Fortunately, Ubuntu and other Linux distributions offer a powerful suite of open-source command-line tools that let you inspect PDF encryption, recover a forgotten password for your own files, and generate a permanent, unlocked copy. In this step-by-step guide, we will walk through the exact workflow using native Linux utilities. Tools We Will Use Before diving into the commands, here is a quick overview of the toolkit we are going to install: qpdf: Inspects PDF encryption details and decrypts files once authorized credentials are available. John the Ripper: A widely used password-auditing tool capable of recovering forgotten PDF passwords. pdf2john: A utility script that extracts password hashes from encrypted PDFs so John the Ripper can analyze them. PDFtk: A versatile toolkit for manipulating, merging, and decrypting PDF documents. Poppler Utilities (poppler-utils): A collection of tools (pdfinfo, pdftotext, etc.) used to inspect metadata and extract content. Understanding PDF Password Protection Not all PDF locks work the same way. PDF documents generally support two distinct types of password protection: Password Type Description User Password (Open Password) Required just to open and read the contents of the PDF. Owner Password (Permissions Password) Allows anyone to view the document, but restricts actions like printing, editing, or copying text. Important Distinction: If your PDF opens normally without a prompt but blocks you from printing or copying text, it has owner-password protection. If a dialog box asks for a password before displaying the pages, it has open-password protection. Step 1: Update Ubuntu and Install Required Applications First, open your terminal (Ctrl + Alt + T) and update your system's package repositories to ensure you get the latest versions of the tools: sudo apt update && sudo apt upgrade -y

Next, install all the required PDF utilities in one command: sudo apt install qpdf pdftk-java john poppler-utils -y

Verify that every application was installed properly by checking their version numbers: qpdf --version
pdftk --version
john --version
pdfinfo -v

Step 2: Inspect the PDF Encryption Navigate to the folder where your locked PDF is stored (for example, your Downloads directory) and make a backup copy before making any changes: cd ~/Downloads
cp protected.pdf protected_backup.pdf

Run qpdf to inspect the document's encryption settings: qpdf --show-encryption protected.pdf

You can also inspect the document's metadata using pdfinfo: pdfinfo protected.pdf

Look closely at the Encrypted field in the terminal output. To quickly verify whether the file blocks reading without a password, test extracting text to standard output: pdftotext protected.pdf -

If the terminal prompts you for a password or throws an authentication error, the file has open-password protection. Step 3: Handle Owner-Password Protection If your PDF opens normally in a viewer but restricts printing, copying, or editing, inspect its permissions first: qpdf --show-encryption protected.pdf

If you have the necessary authorization and the document permits access without an open password, you can often generate an unrestricted copy directly with qpdf: qpdf --decrypt protected.pdf unlocked.pdf

Verify that the newly created file is structurally sound: qpdf --check unlocked.pdf

(Note: If the file enforces an owner password that requires credentials you do not have, --decrypt alone will not bypass it.) Step 4: Recover a Forgotten Open Password If your PDF requires a password just to open, you will need to recover the password first using John the Ripper. 1. Locate the pdf2john Extraction Utility Search your system to find where the pdf2john script is located: find /usr -name 'pdf2john*' 2>/dev/null

(Depending on y...
Remove Forgotten PDF Passwords on Ubuntu/Linux
Powered by Readybot.io

Последнее от Pixel

Fix GitHub Pages: Missing Artifact Error

Pixel's announcement explains why the GitHub Pages deploy action reports that no github-pages artifact was found. It covers skipped or failed build jobs, missing uploads, …

Rotate DB and Redis Passwords Without Downtime

Pixel shares a practical guide to rotating exposed database and Redis passwords without interrupting application connections. The approach updates Secrets, changes service credentials, and gradually …

AI Agent Earns Crypto from $0: Day 3 Update

Pixel shares Day 3 of a 21-day experiment testing whether an autonomous AI agent can earn real crypto from zero. The agent launched a pay-per-call …

AI Agent Receipts Prove What Actually Executed

Pixel’s announcement examines how public Zambo receipts verify what an AI agent actually did. A BTC price fetch succeeded with a recomputable output hash, while …