How to secure your PDF documents with passwords (and how to crack them if needed)
Documents safety is a particularly sensitive matter due to the typical usage nature and possible value and importance of the contents. That said, users should be extra careful when sharing documents that shouldn't be leaked to other parties. Even when being careful though, this may go wrong and a shared document may fall into the wrong hands. For this reason, authors should always incorporate an additional safety net that could easily be password.
Setting up a password
Here's how to secure a PDF document with a password using LibreOffice:
You choose the “File/Export to PDF” option and navigate to the “Security” tab. There you will find the “Set Passwords” buttons that will let you set a password for opening the file, or/and a password for editing permission. After setting the passwords, you can click the “Export” button and you are done.
As simple and quick as this may be, most people out there don't add a password on their PDF files even in cases that require higher levels of security. One of the main reasons for this is the user's negligence while other reasons include the ability to crack the pass anyway, and with relative ease.
How to crack it
There is always the case that you forgot the password that you set a while ago, and now you can't open the document. Thankfully, there's a tool that is dedicated to finding passwords to PDF files that is named “pdfcrack”. Ubuntu users can install it by typing the following command on a terminal:
sudo apt-get install pdfcrack
and pressing enter.
Now open your file manager and navigate to the location of the password-secured document and open a terminal there (or navigate through your terminal by using the “cd” command to change directory). You may then use the “pdfcrack -f filename.pdf” command to let the tool run and try to guess the password. The average speed of this guessing process depends on your system resources and CPU abilities.
Now this may take ages to complete depending on your system and the complexity of the password. By pressing “ctrl+c” you can interrupt the process and save the state to savedstate.sav for resuming the process later. You can do this with the following command: “pdfcrack -f filename.pdf -l savedstate.sav”. To speed up the process, you can use some of
For more parameters, you can enter pdfcrack -help on a terminal and the various choices will be printed. Remember that howtoforge.com provides the above info for recovering lost passwords of your own files, NOT for illegitimately accessing information of locked and/or secured files.