16.07.2010 last update 27.09.2013
OK, so we suppose that you have a pdf file with a *forgotten* password on it. You can view the file, but you cannot edit or print it.
Use Evince or Okular to open the pdf. Evince seems not to care about the limitations, and Okular can be instructed to do so (Settings/Configure Okular/General/Obey DRM limitations)
$ pdftops Protected_password.pdf Passwordless.ps
$ ps2pdf Passwordless.ps Passwordless.pdf
Using your weapon of choice (for example PDF Editor), you can now modify the file (a copy of the original without the restictions).
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=unencrypted.pdf -c .setpdfwrite -f encrypted.pdf
Taken from here.
The solution seems not be working anymore, gs is asking for the password now. If you have it, but want to obtain a copy of your pdf without any password, run:
qpdf --password=YOUR-PASSWORD --decrypt input.pdf output.pdf