Crack the password of pdf files in Linux with pdfcrack (+ Dictionary)

Just last saturday Icarus Perseus He asked me to program a script or 'something' that would allow him to find out the password of a .PDF file, I started to do it now looking for applications in the repository that would allow me this and ... I found pdfcrack

pdfcrack It is testing passwords in a PDF file until it finds the correct one and indicates it to us, you can test passwords by brute force or by using a dictionary that we indicate (as we will do below).

Suppose we have a file called pdf-protected.pdf As its name indicates, a password is required to open it. The password will be: bmxrider

Let's install first pdfcrack, in distros like Debian, Ubuntu or based on these:

sudo apt-get install pdfcrack

On other distros, just look for that package in their official repositories.

Once we have the package installed, using it is really simple, but first let's download the dictionary that I have prepared for you. A dictionary is a lot of possible passwords, usually there are millions and the applications (in this case pdfcrack) will search those millions of passwords, testing each one of them and trying to 'discover' the correct password for what you want to violate. The password dictionary that I have prepared for you has almost 6 million passwords, it weighs approximately 60MBs:

Download password database (Dictionary)

Once downloaded, unzip it and voila, we are ready to use pdfcrack + Dictionary

Open a terminal where we are located in the same folder as dictionary.lst (file that appeared when unzipping dictionary-of-passwords.7z) and also pdf-protected.pdf and put the following:

pdfcrack pdf-protegido.pdf --wordlist=diccionario.lst

This will suffice for pdfcrack try using the database dictionary.lst know the password of the file pdf-protectedHere is a screenshot of the process and the result:

As you can see, the password of the protected PDF file is: bmxrider , just the one I told you above. That password is obviously in dictionary.lst. In the screenshot you can see that almost 25.000 passwords are tested per second, in the example almost 2 million passwords (until I find bmxrider, the one) in only 2 and a half minutes 😀

This is using a dictionary, in case you don't want to use a dictionary (and try to get the password brute force) just do not put the end of the instruction, that is, they would have:

pdfcrack pdf-protegido.pdf

This will test hundreds of thousands, millions of combinations yes ... but it will be a long process, very long depending on the complexity of the password, it could take hours or days 😉


To crack the password of a PDF file need to install pdfcrack, they need a password dictionary (download and unzip it) and then execute the instruction mentioning the file you want to crack and the location of the password dictionary, for example:

pdfcrack /home/usuario/Documentos/pdf-protegido.pdf --wordlist=/home/usuario/Descargas/diccionario.lst

What is simple? 🙂

Anyway, it is not very common to find password protected pdf files nowadays (at least I rarely find one) but you know, here is the solution in case you forget or do not know the password.


The content of the article adheres to our principles of editorial ethics. To report an error click here!.

15 comments, leave yours

Leave a Comment

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



  1. Responsible for the data: Miguel Ángel Gatón
  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.

  1.   January said

    Useful, very useful, as always 😉
    By the way, is there a way to save these tips somewhere in my account ... kind of favorites? so as not to have to rummage in those moments of "trouble"? hahaha

    1s and keep going makina

    1.    KZKG ^ Gaara said

      Thank you for your comment 🙂
      Actually ... we have not implemented any such system in the blog, you could save the URL in your browser bookmarks or bookmarks, I know that is not what you mean but ... I'm afraid I can't think of anything else now 🙁

      Greetings and thanks again for the comment 😀

      1.    January said

        Thanks for the answer, and you can now build a script that does that, you're already taking einggggg xD


    2.    snock said

      I use getpocket to save entire pages or evernote to save notes like this 😛

  2.   sexiest said

    Excellent! Over there I have some statements of account that the bank sends me that I had not been able to read because I forgot the password and had not had time to go to waste a couple of hours at the branch to change it. I will test this program "sooner than immediately."
    It is also my first post in this forum, so I take this opportunity to congratulate them, I love it!

    1.    KZKG ^ Gaara said

      Thank you for your comment 🙂
      About Cinnamon, read here:

      If you use the dictionary, the processing will be significantly faster, but it is not 100% sure that the password is there, you have the option to try with brute force and it will take longer, luck! 😀

  3.   sexiest said

    ah I was wondering how the logos worked ... even though I'm on Crunchbang with Chromium ... anyway ...

    1.    sieg84 said

      it's just change the useragent.
      there is already an article that explains it.

  4.   eliotime3000 said

    Good tip. Hopefully that program is ported for Windows, since there are many users who read pdfs and do not know how to unlock them.

  5.   anubis_linux said

    very good …… don't you know of any that works for winrar ????

    1.    KZKG ^ Gaara said

      I am working on a script for the same with RAR files 🙂

  6.   st0rmt4il said

    Thanks as always gritty! : D!

  7.   Chow said

    Thank you.

  8.   Mr_E said

    From Ubuntu using Evince I open PDFs (it has never asked me for a password), total, if they have a password it is only a matter of saving them with another name and the new PDF is saved without a password. Even the Windows version does.
    The last time I used this facility was like 6 months ago, I think it still works with at least certain versions of PDF.


  9.   David said

    Unprotecting a PDF file is as simple as "printing" it in a new PDF, although it is protected against printing, it can be unlocked by following these steps: