How to remove password from PDF from Linux

Remove password pdfDF with password

How many times have you come across a PDF with a password and you didn't know it? The most normal thing when we find a PDF with a password is that it has been provided to us by someone we know. For security reasons you put a password, but this password is communicated to us by another means so that we can open the file. If we have to enter the file several times a day it may be a good idea remove password from PDF and in this article we will teach you several tools that can be used from Linux.

Before continuing I would like to make it very clear what this article is about: it is about "removing the password from a PDF", as long as we know her. This means that we will not go into (too much) how to crack a PDF password simply because it may be illegal. The rationale behind this article is basically to create a password-free copy of a PDF that was originally password-protected.

Remove password from PDF

With pdftk

pdftk is a tool available for Linux with which we can remove the password to a PDF from the Terminal. It is very simple and you only have to know a few commands. For this we will do the following:

  1. Before using it for the first time we will have to install the software. We will do it by opening a Terminal window and typing:
sudo apt install pdftk
  1. Once installed we will be able to execute the other command. As we have explained previously, we basically have to create a new one from the original, but without a password. We will do it with the following command:
pdftk /ruta/al/pdf/original.pdf input_pw CONTRASEÑA output /ruta/al/pdf/sin/contraseña.pdf

From the above we have to:

  • pdftk is the call to the program.
  • the paths must be changed to those of the original file and the new one. The new one will create it with the name that we give it in the output path.
  • input_pw PASSWORD It is to tell you the password and that you can do the following. For the clueless, you have to change "PASSWORD" to the password of the PDF.
  • output path / from / output it is where you will save it and under what name.

With QPDF

All very similar to the method with pdftk, QPDF It will allow us to remove the password from a PDF if we know it previously. The steps are practically the same, but with other commands:

sudo apt install qpdf
qpdf –apassword=CONTRASEÑA –decrypt /ruta/al/pdf/original.pdf /ruta/al/pdf/destino.pdf

From the above we have:

  • The first command will install qpdf.
  • From the second command qpdf is the command to call the program.
  • -password = PASSWORD will indicate the password, but logically you have to change "PASSWORD" to the PDF.
  • -decrypt will ask you to remove it.
  • We have to change the paths to those of our original file and the file that we want to create / save with the password already removed.
LibreOffice PDF Options
Related article:
LibreOffice: Create Fillable or Editable PDF

With LibreOffice

Many times we have the simplest solution right under our noses. What we want is to remove the password from a PDF knowing it, which means that we can open the file. If we can open it, we can save it too. To remove the password from a PDF with LibreOffice we will do the following:

  1. Right click on the PDF with password and we open it with LibreOffice Draw.
  2. We enter the password.

Remove password from PDF with LibreOffice Draw

  1. Once open we can save it from "File / Export to PDF ..." and choosing a new name and destination. The options will be the same as always; We configure them to suit the consumer.

Save PDF with LibreOffice draw

Personally, not that I have a Terminal allergy, but the LibreOffice Draw option is the best for me because I can do it all with a GUI program. There is nothing more comfortable for me than getting things done with a few clicks, not to mention that I don't have to install extra software or memorize / save any commands.

Printing the PDF… to PDF

Something I do two or three times a year is return a product to Amazon. It is not that I am a problem customer, but that practically all my purchases are made at the internet sales giant and some go wrong. When I have to send a package back, Amazon sends me a sheet that I have to print to put one part inside the package and the other glued outside the box. I haven't used my printer in years, partly because I would use it very little and the ink costs a fortune, not to mention that I see almost all the photos / documents on a mobile or tablet. What i do is convert that file to PDF and print it in a stationery that will be about 50m from my house.

The process is simple, but impossible to explain in just one way because this is possible in practically all programs that can read a PDF. The process would look something like this:

  1. We open the PDF with any compatible program that also, importantly, can print. If not, we are not worth it.
  2. We enter the password.
  3. Let's go to «File / Print».
  4. This is where each program will have different options, but what we have to do in general is look for the option "print to PDF". If we do not have a printer connected, this is the option that appears by default in many programs.
  5. We give it a name and path and "print" the file. Now we will have the same PDF without password. Simple, right?

How to UNLOCK a PDF password

This requires a dedicated post. It can be done with at least one tool and it is a long process, both in terms of what users have to do and the time it can take to crack the password. Not to mention, the process might never work if the password is very strong.

The tool is called pdfcrack and it is available in the official repositories of some operating systems such as Ubuntu and its derivatives. It is installed with the command sudo apt install pdfcrack and its use will be familiar to all those who have tried AirCrack, the security tool with which we can check if our WiFi is safe trying to decipher your password.

pdf crack works by using brute force, it is accessed with the command pdfcrack -f pdf-name.pdf and the extensive rest we will explain in another post soon.

I hope this guide has helped you because what you wanted was to remove a password that you knew from a protected PDF. If not, be patient because we are preparing another post in which we will get recover a password from your own PDF. As in the case of WiFi, it is not advisable to do it with documents whose permission to open it has not been granted to us, something that is amoral and, what is worse, could be illegal.

poppler_logo
Related article:
Poppler an excellent command line tool for PDF

Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: AB Internet Networks 2008 SL
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.