how to recover forgotten "owner password" of pdf file

I need to resize a pdf file to crop its surrounding white border. I can crop it using PDF-Shuffler on Ubuntu. But cant save the change, because of owner password protection. When i try to open that file using PDF-Editor, it asked for that password.

Since I dont know that owner password, so cant use regular recovery system. There are lots of online system too, but thats very slow process even most of those cant remove owner password. Now looking for a script/software specially for Ubuntu to remove that owner password.


Solution 1:

On Ubuntu you can use the following commands to decrypt PDFs with forgotten Owner Passwords trivially:

  1. Install package qpdf:

    sudo apt-get install qpdf
    
  2. Decrypt PDF:

    qpdf --decrypt encrypted_document.pdf decrypted_document.pdf
    

Notes:

  1. The above instructions assume that you are trying to decrypt a PDF with a forgotten Owner Password (i.e. you can open the PDF and view its content but are restricted from making changes, prints, etc. without the password). These types of encrypted PDFs are trivial to decrypt and don't require tools like pdfcrack or hashcat (dictionary/brute force password crackers)

  2. On the other hand a PDF with a forgotten User Password (i.e. you cannot view the content of the PDF without supplying the password) will require PDF dictionary/brute force password crackers and you are not always guaranteed to find the password. If however you do have the User Password and simply want to save a decrypted version of the PDF you can do this to with qpdf as follows:

    qpdf --password=ENTER_PASSWORD --decrypt encrypted_document.pdf decrypted_document.pdf
    
  3. Windows binaries of qpdf can also be downloaded from http://qpdf.sourceforge.net/

Solution 2:

Ubuntu repositories have a tool called pdfcrack that can be installed using the package manager. This can attempt to brute-force (guess) the password for you.

Important note: in many countries the penalties for circumventing encryption are very severe. Be sure you have the legal right to crack the password before continuing.

Open a terminal and do something like this:

sudo apt-get install pdfcrack
pdfcrack -f MYFILE.PDF