Command Line

Strip Password From A Password-Protected PDF

One company likes to send me a password-protected PDF every month, and it can be a pain typing in the password every time. Fortunately, we don’t have to! To completely remove the password from password-protected PDFs, keep reading!

Now, there are times when removing the password from a password-protected PDF is against corporate policy or may be a violation of regulations. I suppose a good rule might be, “Don’t tamper with the password protection unless the PDF belongs to you.”

That said, it’s actually pretty easy to remove the passwords from password-protected PDFs. It’s easy and I’ll show you how! This won’t even have to be a very long article!

Remove Password From A Password-Protected PDF:

Like oh so many of my articles, this one starts with the terminal open. If you don’t know how to do that, it’s easy. Just use your keyboard and press CTRL + ALT + T and your default terminal emulator will open.

The tool we’ll be using is called ‘qpdf‘ and it describes itself as:

PDF transformation software

Once you have that open, one of the following should help you install qpfd:

Debian/Ubuntu:

sudo apt install qpdf

Arch/Manjaro:

sudo pacman -S qpdf

RHEL/Fedora:

sudo dnf install qpdf

Any of those should get you to the point where qpdf is installed, and there shouldn’t be (m)any dependencies. Using it is just as easy as installing it.

qpdf --password='PASSWORD' --decrypt original.pdf new_file.pdf

Obviously, you change “PASSWORD” to the password that’s used in the password-protected PDF to the actual password. You also use the name (and path) of the PDF and a new name for the new PDF that has no password. That will, of course, remove the password and you can delete the original after verifying that it worked.

BONUS:

You can actually use qpdf to make a password-protected PDF. It’s also easy and the command would look like this:

qpdf --encrypt PASSWORD PASSWORD 256 -- original.pdf new_file.pdf

In this case, the PASSWORD is your new password and it must be typed twice. The 256 is the key-length used to encrypt the PDF. To get more information like that, just run:

qpdf --help

In there, you’ll see that qpdf is really quite a potent application. It can do so much more than just stripping the password from a password-protected PDF. So, give that help file a scan and see what other features it has!

CLOSURE:

See? I told you that this article wouldn’t take all that long. Best part? It’s another in what’s a growing list of articles and it’s something you can actually use when you get a password-protected PDF. Again, if you’re gainfully employed or in a regulated occupation you may not want to remove the password protection.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

KGIII

Retired mathematician, residing in the mountains of Maine. I may be old and wise, but I am not infallible. Please point out any errors. And, as always, thanks again for reading.

Recent Posts

Update Python Packages (PIP)

We've had a run of Python packages recently and you can tell that I'm a…

2 days ago

Save A Command’s Output To A File (While Showing It In The Terminal)

The title is the best I can come up with to describe this exercise as…

4 days ago

Demystifying journalctl: A Comprehensive Guide to Linux System Logging

It was suggested that I write an article about journalctl, which seemed like a large…

6 days ago

Extract Text From Multiple File Types

Today we will have a fairly simple exercise as we're going to just use a…

1 week ago

Meta: I’ve Been At This For Three Years!

I have not done a meta article lately. I don't find them interesting to write…

1 week ago

How To: Disable CPU Cores

This is not something everyone is interested in doing but you might as well learn…

2 weeks ago