Skip to content

Instantly share code, notes, and snippets.

@ILPlais
Created January 14, 2026 14:13
Show Gist options
  • Select an option

  • Save ILPlais/0e7f42f6c77d1450dcf5495f865cc121 to your computer and use it in GitHub Desktop.

Select an option

Save ILPlais/0e7f42f6c77d1450dcf5495f865cc121 to your computer and use it in GitHub Desktop.
Encrypt an existing PDF without display passwords in the command-line
#!/bin/bash
echo -e "User password:"
read -s user_pw
echo -e "Owner password:"
read -s owner_pw
echo
qpdf --encrypt "$user_pw" "$owner_pw" 256 -- "$1" "$2"
unset user_pw owner_pw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment