Password Protect a PDF Document

August 12, 2022 - Reading time: ~1 minute

I recently had the need to add a password to a PDF file while also locking it down, but I also needed to retain the ability to edit it myself. I didn't want to use anything like Adobe's PDF application and, obviously, preferred to use Open Source and the command line. After a little bit of searching, I found that the pdftk tools, which I already had installed, did exactly what I needed.

$ pdftk input.pdf output output.pdf owner_pw 'password1' user_pw 'password2'

Two passwords are set: The owner's password protects the document and allows the owner to edit it. The user's password protects the document and also locks it down. Perfect.


Categories