How to remove the password from a PDF using the terminal on Ubuntu / Debian?

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

Hello, friends. In this post, you will learn how to remove the password from a PDF file using the terminal in Ubuntu / Debian. This is important to know when you want to share the file with a third party.

As we all know, a PDF file can be protected using a password, but there comes a point where if we would like to share the file, we should remove the password.

In this post, we assume that you own the file and therefore know it. Let’s get started.

Remove the password from a PDF file

Although there is a way to do this using a graphical interface, I assure you that using the terminal is faster and more direct.

First, open a terminal and make sure that the pdftk package is in the pdftk package.

sudo apt update
sudo apt install pdftk

What does pdftk do? PDFtk is a simple tool for doing everyday things with PDF documents. It is free and although it has paid features, the truth is that the version that comes in the official repositories is enough.

For testing purposes, open the protected PDF and you can be sure that it is still protected.

File protected with a password
File protected with a password

Now all you have to do is run this command

pdftk /path/to/input.pdf input_pw [yourpassword] output out.pdf

This will create a copy of the PDF, but without the password. What is the purpose of this? Well, to remove the password so that when you share it, the receiver can open it without any problem.

In my case, the command is

pdftk sample.pdf input_pw angelo output sample-without-password.pdf

And so, you will have the file without password and with another name.

Remove the password from a PDF
Remove the password from a PDF

The qpdf command also does the job

Some users report that pdftk does not work with all the PDFs they have handled, but there is always an alternative such as qpdf.

You can install it without problems

sudo apt install qpdf

And use it like this to remove the password

qpdf --password=your-password --decrypt /path/to/secured.pdf out.pdf

In my case,

qpdf --password=angelo --decrypt sample.pdf sample_without.pdf

So, in this quick and easy way, you can remove the password from a PDF file.

Conclusion

Now you know how to remove the password from a PDF file using the terminal on systems like Debian and Ubuntu. It is possible that you will use it sometime.

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"
Angelo
Angelo
I am Angelo. A systems engineer passionate about Linux and all open-source software. Although here I'm just another member of the family.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook