2022 / 07 / 07
Remove PDF password in Linux

Let's see how turn a password protected file into a normal one.

linux
pdf
password

Using QPDF

QPDF is a command-line program for Linux that converts from one PDF file to another equivalent PDF file while preserving the content of the file. The tool allows you to encrypt and decrypt, web-optimize, and split and merge PDF files.

If you are using Manjaro, QPDF should be already installed. In case it is not, try with:

sudo pacman -S qpdf

To convert a secured file into an open one, use this command:

qpdf --password=mysecretpassword --decrypt the-secured.pdf new-unsecured.pdf

Preventing the command being logged to .bash_history

Type this previous to the command —or have it in your .bashrc and reopen a terminal:

export HISTCONTROL=ignoredups:ignorespace

Then, to skip commands from ending inside your .bash_history just add a space before them.

 qpdf --password=... # notice the space at the beginning

Reference