Remove the owner password from an encrypted PDF using Ghostscript
Note: you still need to know the password for opening the file
brew install ghostscript # on macOS
gs -q -dNOPAUSE -dBATCH -dPrinted=true -dShowAnnots=false -sDEVICE=pdfwrite -sPDFPassword=YOUR_PDF_PASSWORD -sOutputFile=unlocked.pdf -f locked.pdf