Portable Document Format (PDF) files are the backbone of modern document distribution. With them, you can: Format any document Easily and expect it to be readable on different devices. Here's how to remove a password from a PDF file in Linux.

The PDF standard also includes the ability to secure your documents with simple password-based encryption. However, this approach requires you to keep track of each password for each PDF file you encrypt. This can be a problem if you want to keep an archive of PDF files for project or bookkeeping purposes.
This tutorial shows you how to remove the password from an encrypted PDF file on Linux. Additionally, we also show you how to recover the password for an encrypted PDF file.
Tip: Looking to add your signature to a PDF on the go? We have the solutions.Sign a PDF file on your Android phone.
Remove password from encrypted PDF file
One of the easiest ways to remove the password from an encrypted PDF document is to "reprint" a copy of it using your system's document viewer. By default, the encryption algorithm that protects a PDF only operates when the data is at rest.
This means that once you open the document, you can easily create an unencrypted duplicate copy using the option Print to PDF Viewer specific.
- Open PDF file Encrypted using PDF Reader Your.
- The PDF viewer will ask you for a password for your document. Enter your password to open the document.
- go to the PDF reader list.
- Click on Printer button (or print option).
- Select an option Print to file In the main window portion of the Print menu.
- Click the radio button. "PDF" Next to the text box "file".
- Click the button "print" To save your PDF document without encryption.
Remove PDF password using command line
It's also possible to remove an encrypted PDF password directly from the command line. This can be useful if you want to create a script and automate the removal process.
To do this, get qpdf. This is a simple editing tool that can convert and edit the internal properties of a PDF file. You can install qpdf on Ubuntu by running the following command:
sudo apt install qpdf

On the device, navigate to the directory of the encrypted PDF file and run the following command:
qpdf --password=maketecheasier --progress --decrypt ./encrypted.pdf ./output.pdf

You can too Create a script Simple to automate decryption of an entire directory:
mkdir ./output for i in *.pdf; do qpdf --password=maketecheasier --progress --decrypt "${i}" ./output/"${i}"; done. done

Enforce PDF password using pdfcrack
While the above methods will work for PDF files for which you know the password, there are cases where this isn't the case. This can be a problem if you're dealing with an old PDF archive where you've lost the password.

One way to solve this problem is to install and use the pdfcrack utility. This is a simple program that "cracks" a PDF document's encryption by repeatedly guessing its password, either from a dictionary file or random text.
You can install pdfcrack in Ubuntu by running the following command:
sudo apt install pdfcrack

Navigate to the directory containing the encrypted PDF file and run the following command:
pdfcrack -f ./encrypted.pdf
It's important to note that this process can take a long time to complete. For example, a long password containing a combination of symbols and letters can take up to an hour to crack.

You can mitigate this problem by providing a dictionary file to pdfcrack. This is a plain text file containing common passwords you might use in your documents.
You can run the following command to use a dictionary file with pdfcrack:
pdfcrack -f ./encrypted.pdf --wordlist=/home/$USER/Documents/passwords.txt

Finally, you can restrict certain parameters that pdfcrack uses during brute force cracking. This is useful if you have a vague idea of the length and type of your PDF password.
For example, the following command will tell pdfcrack to guess passwords that contain the characters “sqweartkcyuihop” and are either 12 or 14 characters long.
pdfcrack -f ./encrypted.pdf --charset="sqmweartkcyuihop" --minpw=12 --maxpw=14

Frequently Asked Questions
Q1: Is it possible to copy the encryption of a PDF file to another file?
The answer: Yes. With qpdf, you can "export" encryption settings from one PDF file to another. This is useful if you want to create a script that automatically encrypts a PDF directory using the same password.
You can do this by running the following: qpdf ./new.pdf –copy-encryption-file=./encrypted.pdf –encryption-file-password=mysuperpassword ./output.pdf.
Q2: What are the disadvantages of using the “Print to File” function?
The answer: One of the biggest downsides of using this function is that it will remove any editable fields and plain text within the PDF file. The encrypted PDF will lose all text boxes within it, and you won't be able to copy text from it.
Q3: I accidentally aborted pdfcrack. Is it possible to resume from where I left off?
The answer: By default, pdfcrack always creates a "state" when it accidentally exits. This is a file containing the program's last password attempt and its progress through the current process. To resume your last session, run the following: pdfcrack -f ./encrypted.pdf –loadstate=./savestate.sav.





