I have been sent one of those dreadful .pdf documents. I need to save it as 'password protected' how do I do that in LibreOffice? There's lots of information on creating a password protected pdf document but I can find nothing on password protecting an existing .pdf.
-
2To prevent what? You do know there are tools that simply remove the password from the pdf. You do not even need to know the password. "Advanced PDF Password Recovery" can "Instantly unlocks PDF documents with printing, copying and editing restrictions", "Removes “owner” and “user” passwords" and many more.– RinzwindJul 20, 2017 at 13:42
-
Just looked at this post again - my reply has gone missing. So: Thanks Rinzwind, didn't know that. "To prevent what?" - Good Q; sender instructed me to protect it. I shall look at pdftk suggested by six2dez once I've found out how much disc space it devours.– NicJul 23, 2017 at 8:11
-
I might be better to ZIP the thing and put a sha512 pwd on the zip.– RinzwindJul 23, 2017 at 8:33
-
@Rinzwind: While weakly-encrypted (40 bit) PDFs can be decrypted, I think it's inaccurate to say that one can "simply remove" the password. The product you mentioned doesn't claim to be unconditionally successful on 256-bit AES encryption either.– Matthias BraunAug 18, 2020 at 17:20
-
An attacker can modify an encrypted PDF so that its contents are sent to them (the attacker) when a user (who knows the password) opens it. This could happen when the file is sent e.g. by email.– z0rJun 10, 2021 at 10:36
2 Answers
You can do this with pdftk
. It is a powerful command line tool to manage PDFs.
pdftk source.pdf output destination.pdf user_pw password
-
1Use
pdftk source.pdf output destination.pdf user_pw PROMPT
to have it ask you for a password. This is good practice, because it prevents the password from being visible in your shell history file and to other users and processes viaps
.– z0rJun 10, 2021 at 10:19
At the command line
qpdf --encrypt test123 test123 40 -- input.pdf doc_with_pass.pdf
Where test123 is both the user and owner password, the next value is for encryption key-length which may be 40, 128, or 256.
To decrypt the pdf file you can use the following
qpdf --password=test123 --decrypt doc_with_pass.pdf doc_without_pass.pdf
-
3This is what I use to password protect (encrypt) PDF with 128-bit AES encryption (requires PDF v1.6): "qpdf --encrypt user-password owner-password 128 --use-aes=y -- input.pdf doc_with_pass.pdf"– NeonAug 3, 2018 at 20:19
-
Is there a way to create a read-only file, no printing, without a password? Nov 23, 2020 at 16:35