Password lock PDF files with pdftk

If you need to lock a PDF file with a password on Linux, there is an easy way to do it even if it requires a terminal.

We need a program called pdftk. Install it with your package manager (for example on Debian/Ubuntu, run “sudo apt-get install pdftk”), and then from the terminal run the following command:
pdftk source.pdf output destination.pdf user_pw password
Of course instead of source.pdf you should input the name of the original pdf file (and eventually the full path if it isn’t on the local directory where the terminal is), for destination.pdf you should write the name of the password protected PDF file (it has to be a different name from the original), and obviously for destination.pdf you should write the password you want to use.