0% found this document useful (0 votes)
117 views

HowTo - Linux Remove A PDF File Password Using Command Line Options

The document discusses several methods for removing passwords from PDF files using command line tools on Linux, including pdftk, qpdf, xpdf-utils, and Evince. It provides code examples for using each tool to decrypt a PDF file and remove the password, outputting an unencrypted file.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
117 views

HowTo - Linux Remove A PDF File Password Using Command Line Options

The document discusses several methods for removing passwords from PDF files using command line tools on Linux, including pdftk, qpdf, xpdf-utils, and Evince. It provides code examples for using each tool to decrypt a PDF file and remove the password, outputting an unencrypted file.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

2/3/23, 20:05 HowTo: Linux Remove a PDF File Password Using Command Line Options - nixCraft

nixCraft → Howto → Linux → HowTo: Linux Remove a PDF File Password Using
Command Line Options

HowTo: Linux Remove a PDF File


Password Using Command Line Options
Author: Vivek Gite
Last updated: November 21, 2022
49 comments

I
get lots of e-bills (utility, telephone, the Internet, mobile, cable
and so on) in a PDF format for my small business, and I need to
forward those to my accountant. However, all PDFs files are
password protected. I do not want to share my account password
with anyone to just open my bills. Evince is a PDF document viewer
capable of displaying password protected files, but it cannot remove the password.
How do I remove a password from all PDFs under Ubuntu or any other Linux
distribution in a batch mode?

Tutorial details

Difficulty level Intermediate

Root privileges Yes

Requirements Linux terminal

Category Modern utilities

Prerequisites pdftk or qpdf utilities

Alma • Arch • Debian • Fedora • Linux • Mint • openSUSE • RHEL • Rocky


OS compatibility
• Stream • SUSE • Ubuntu

https://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/ 1/26
2/3/23, 20:05 HowTo: Linux Remove a PDF File Password Using Command Line Options - nixCraft

Tutorial details

Est. reading time 3 minutes

ADVERTISEMENT

You can remove the password using various utilities under Linux. Use any one of the
following options:

1. pdftk – A handy tool for manipulating PDF file.

2. qpdf – The qpdf program is used to convert one PDF file to another equivalent
PDF file.

3. xpdf-utils – Portable Document Format (PDF) suite — utilities such as pdftops


and ps2pdf.

4. Print to a file – Use Evince software itself.

How Do I Use pdftk To Remove The Password?


Type the following apt-get command/apt command to install the pdftk (note it will
install java too, if you do not like java, just use another tool):

$ sudo apt-get install pdftk

Decrypt a PDF called input.pdf with YOURPASSWORD-HERE password and create


unencrypted output.pdf, enter:

pdftk input.pdf output output.pdf user_pw YOURPASSWORD-HERE

OR

pdftk input.pdf output output.pdf user_pw YOURPASSWORD-HERE owner_pw YOURPASSWORD-HERE

https://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/ 2/26
2/3/23, 20:05 HowTo: Linux Remove a PDF File Password Using Command Line Options - nixCraft

OR

pdftk input.pdf output output.pdf input_pw YOURPASSWORD-HERE

Where,

input_pw password : Input PDF owner passwords

user_pw password : Input PDF user passwords

owner_pw password : Input PDF owner passwords same as input_pw.

How Do I Use qpdf To Remove The Password?


Type the following apt command to install the qpdf:

$ sudo apt-get install qpdf

Decrypt a PDF called input.pdf with YOURPASSWORD-HERE password and create


unencrypted output.pdf, enter:

qpdf --password=YOURPASSWORD-HERE --decrypt input.pdf output.pdf

How Do I Use xpdf-utils To Remove The Password?


Type the following command to install the qpdf:

$ sudo apt-get install xpdf-utils

First, decrypt a PDF and create a postscript file, enter:

pdftops -upw YOURPASSWORD-HERE input.pdf

https://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/ 3/26
2/3/23, 20:05 HowTo: Linux Remove a PDF File Password Using Command Line Options - nixCraft

You will get input.ps file. This can be printed or open under Linux itself. But, you can
convert it back .ps file (postscript)back to a PDF as follows:

ps2pdf input.ps

Please note that the ps2pdf command is part of ghostscript and it will get installed
when you run xpdf-utils.

How Do I Use evince To Remove The Password?


Open a pdf file using evince itself, enter:

evince input.pdf

Enter your password. Once opened click on File > Print > Select “Print to file” >
Select “PDF” as output format and click on Print.

https://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/ 4/26
2/3/23, 20:05 HowTo: Linux Remove a PDF File Password Using Command Line Options - nixCraft

Fig.01: PDF file remove password with evince print option

Writing a shell script left as an exercise to the readers.

If You Don’t Know The Password, Use Ghostscript Like This


Update: nickwe pointed out the following command:

gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=unencrypted.pdf -c .setpdfwrite -f en

About the author: Vivek Gite is the founder of nixCraft, the oldest running blog
about Linux and open source. He wrote more than 7k+ posts and helped numerous
readers to master IT topics. Join the nixCraft community via RSS Feed or Email
Newsletter.

🥺 Was this helpful? Please add a comment to show your appreciation or


feedback. Support the nixCraft with a PayPal donation or Patreon

🔎 To search, type & hit enter...


Related Tutorials

Creating A tar File in Linux Via Command Line Options

Reconfiguring FreeBSD Ports - Remove OPTIONS config For Any…

Howto Open a PDF file under Linux / FreeBSD

Bash Shell: Replace a String With Another String In All…


https://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/ 5/26
2/3/23, 20:05 HowTo: Linux Remove a PDF File Password Using Command Line Options - nixCraft

Configure Linux / UNIX Dns Resolver To Append Domain Search…

Linux Security: Mount /tmp With nodev, nosuid, and noexec…

Increase NFS Client Mount Point Security For a Web-Server…

Category List of Unix and Linux commands

Ansible Check version • Fedora • FreeBSD • Linux • Ubuntu 18.04 • Ubuntu • macOS

Backup
Debian/Ubuntu • FreeBSD • RHEL
Management

Backup MySQL server • MariaDB Galera cluster • MariaDB TLS/SSL • MariaDB


Database Server
replication • MySQL Server • MySQL remote access

Download
wget
managers

Driver Management Linux Nvidia driver • lsmod

Documentation help • mandb • man • pinfo

Disk Management df • duf • ncdu • pydf

File Management cat • cp • less • mkdir • more • tree

Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 •


Firewall
Ubuntu 20.04 • Ubuntu 24.04

KVM Virtualization CentOS/RHEL 7 • CentOS/RHEL 8 • Debian 9/10/11 • Ubuntu 20.04

Linux Desktop apps Chrome • Chromium • GIMP • Skype • Spotify • VLC 3

LXD Backups • CentOS/RHEL • Fedora • Mount dir • Ubuntu 20.04

https://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/ 6/26
2/3/23, 20:05 HowTo: Linux Remove a PDF File Password Using Command Line Options - nixCraft

Category List of Unix and Linux commands

Modern utilities bat • exa

Network Monitoring tools • Network services • RHEL static IP • Restart network interface •

Management nmcli

Network Utilities NetHogs • dig • host • ip • nmap • ping

CentOS 7 • CentOS 8 • Debian 10 • Debian 11 • Debian 8/9 • Ubuntu 18.04 •


OpenVPN
Ubuntu 20.04

Power Management upower

Package Manager apk • apt-get • apt • yum

Processes bg • chroot • cron • disown • fg • glances • gtop • iotop • jobs • killall • kill • pidof •

Management pstree • pwdx • time • vtop

Searching ag • egrep • grep • whereis • which

Shell builtins compgen • echo • printf

System
reboot • shutdown
Management

Terminal/ssh sshpass • tty

Text processing cut • rev

Text Editor 6 Text editors • Save and exit vim

User Environment exit • who

groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami


User Information
•w

User Management /etc/group • /etc/passwd • /etc/shadow • chsh

Web Server Apache • Let's Encrypt certificate • Lighttpd • Nginx Security • Nginx

Alpine • Amazon Linux • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 •


WireGuard VPN
qrencode

https://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/ 7/26
2/3/23, 20:05 HowTo: Linux Remove a PDF File Password Using Command Line Options - nixCraft

49 comments… add one ↓

M.M
Jan 13, 2010 @ 10:17

You didn’t “Remove” the password, you just change it and only because you know
the owner password. If I send you a pdf with my password you’ll not be able to
change anything, maybe you should change you’re title to “Linux Update a PDF File
Password Using Command Line Options”

reply link

D
Jan 13, 2010 @ 11:11

M.M is right.

reply link

rahul
Jan 13, 2010 @ 11:57

Very well written and overcome lots of irritating passwords. Very good note.

reply link

nickwe
Jan 13, 2010 @ 16:33

If you don’t know the password, use Ghostscript like this:

gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -


sOutputFile=unencrypted.pdf -c .setpdfwrite -f encrypted.pdf

Regards,

https://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/ 8/26
2/3/23, 20:05 HowTo: Linux Remove a PDF File Password Using Command Line Options - nixCraft

Nicolas.

Edited by admin – added code tags.


reply link

John
Apr 23, 2010 @ 20:09

Hi,
that gs command on linux doesnt work with certain PDFs… wherease those some
PDFs are correctly de-crypted with that command on Windows.
Does an alternative method exist for removing protections from PDFs on linux ?

thank you

reply link

Julio
Feb 10, 2012 @ 17:38

Thank you very much… your help is highly appreciated

reply link

Evengard
Feb 8, 2016 @ 12:37

For removing owner password without knowing it (and all restrictions) use:

qpdf --decrypt protected.pdf unprotected.pdf

Note that it won’t work if you don’t know the USER password. OWNER password
is only for enforcing restrictions, USER is for opening the file and be able to view it.

reply link

tkto
https://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/ 9/26
2/3/23, 20:05 HowTo: Linux Remove a PDF File Password Using Command Line Options - nixCraft

Aug 12, 2022 @ 20:09

Thank you very much it works very well. I used it in Manjaro KDE 2022

reply link

Greg
Jan 17, 2010 @ 18:00

You could just ‘print’ the file to postscript, and then use ps2pdf to make a new pdf.

reply link

meho_r
Jan 21, 2010 @ 19:53

Thanks a lot, Nicolas, that worked perfectly :-)

reply link

fiox
Apr 18, 2010 @ 20:43

Very Very Good

reply link

Nilesh
May 27, 2010 @ 15:08

The ghostscript command does not work :(


[nilesh@Linux Nilesh]$ gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -
sOutputFile=unencrypted.pdf -c .setpdfwrite -f /home/nilesh/1.10532926.pdf
**** This file requires a password for access.
**** The file was produced by:
**** >>>> [ReportSuite Version 6.0.0] on AIX <<<<

https://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/ 10/26
2/3/23, 20:05 HowTo: Linux Remove a PDF File Password Using Command Line Options - nixCraft

Error: /invalidfileaccess in pdf_process_Encrypt


Operand stack:

Execution stack:
%interp_exit .runexec2 –nostringval– –nostringval– –nostringval– 2 %stopped_push
–nostringval– –nostringval– –nostringval– false 1 %stopped_push 1878 1 3
%oparray_pop 1877 1 3 %oparray_pop 1861 1 3 %oparray_pop –nostringval– –
nostringval– –nostringval– –nostringval– false 1 %stopped_push
Dictionary stack:
–dict:1151/1684(ro)(G)– –dict:1/20(G)– –dict:75/200(L)– –dict:75/200(L)– –
dict:108/127(ro)(G)– –dict:288/300(ro)(G)– –dict:18/25(L)–
Current allocation mode is local
GPL Ghostscript 8.71: Unrecoverable error, exit code 1
reply link

el_ingeniero
Jul 23, 2010 @ 0:39

the ghostscript command doesn’t seem to work on forms. The file gets decrypted ok,
but the form fields get stripped out.

reply link

Denilson Figueiredo de Sá
Sep 20, 2010 @ 8:35

In my case, I knew the User-password (although I didn’t know the Owner-password).


Here is my experience when using these tools:

pdftk – It requires the Owner-password.


qpdf – Worked perfectly!
xpdf-utils – I’d like to avoid PDF -> PS -> PDF, as it could increase the file size and
maybe lose some PDF features.

https://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/ 11/26
2/3/23, 20:05 HowTo: Linux Remove a PDF File Password Using Command Line Options - nixCraft

Print to a file (using Evince) – It works, but the final PDF was 3 (or more) times
larger than the original.

So, the best solution for me was qpdf, as it converted a PDF directly to another PDF,
kept the file size almost the same as the original (in fact, it shrunk a little), and it
worked fine with the only password I had.
reply link

Misha
Oct 9, 2010 @ 21:13

> pdftk – It requires the Owner-password.


> qpdf – Worked perfectly!

same for me, including

>the best solution for me was qpdf, as it converted a PDF directly to another PDF,
>kept the file size almost the same as the original

in my case there was a very small increase of a file size, 5.38 Mb (encrypted) -> 5.40
Mb (decrypted).

reply link

martin alexander
Oct 23, 2010 @ 1:42

martin writes: Hi Denilson — I enjoy your blog very much , but now I have a question
of different sort ; my friends from Poland just went to Rio for 10 months to keep their
15 year old daughter away from bad influences in Warsaw , – they took an Asus EEE
PC 120 A comp with them but forgot to pack the powering cable with them … so now
they are in Rio and can’t charge up their comp . I will try to locate their cable and ship
it to them but at the same time I was curious that perhaps you ( being in Rio) may
suggest some better solution for them (shipping takes quite a long time ) –I would

https://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/ 12/26
2/3/23, 20:05 HowTo: Linux Remove a PDF File Password Using Command Line Options - nixCraft

appreciate very much any of your thoughts on that matter — my email is ;


[email protected] best wishes –yours truly –martin alexander
reply link

Travis
Dec 29, 2010 @ 0:05

evince isn’t a true command line option as it requires X and my servers don’t have X
so not even a viable solution. I also agree with MM as I don’t have the passwords to
the documents I’ve been sent but still need to read the PDFs to place in the correct
place on our servers and none of these options provide a solution.

reply link

robert
Jan 1, 2011 @ 18:24

Hi,

Thank you very much for this useful infos.


Nickwe comment is working for me.
(gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=unencrypted.pdf -c
.setpdfwrite -f encrypted.pdf)

Robert

reply link

datt
Mar 31, 2011 @ 14:32

i used command called CAT > telnet.pdf after using this command my entire pdf file
are not opening what do i do now? please any one can help me out….

reply link

https://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/ 13/26
2/3/23, 20:05 HowTo: Linux Remove a PDF File Password Using Command Line Options - nixCraft

RAMI
Jun 15, 2011 @ 14:22

I want to open some pdf file which are locked from opening can i use the command
line in window os.

reply link

Scott
May 14, 2012 @ 21:32

I was looking to install qpdf on Centos, but yum install wouldn’t do it. I had to use the
following to get it installed.

Download qpdf source from qpdf.sourceforge.net/


yum install zlib pcre zlib-devel pcre-devel
./configure
make
make install

reply link

Rangi
Nov 27, 2012 @ 7:26

Worked for me on Red Hat, thanks!

reply link

UserLinux
Jun 17, 2012 @ 18:13

Thanks a lot!!
$ gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=unencrypted.pdf -c
.setpdfwrite -f encrypted.pdf
it worked! I only waited 10 or 12 minutes!

reply link
https://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/ 14/26
2/3/23, 20:05 HowTo: Linux Remove a PDF File Password Using Command Line Options - nixCraft

cborlee
Jul 19, 2012 @ 4:46

I made some test.


1. If the encrypted pdf file set an “file open” password, and you don’t know the
password. Then neither pdftk, qpdf nor gs can decrypt the pdf.
2. If you know either owner or user password, you can decrypt the pdf with qpdf.
Though there may have som error message. The idea is that you can open and show
the content first.
3. ghostscript method is great! and I use it on win32, find gs for win32 on
http://sourceforge.net/projects/ghostscript/ (gs905w32.exe 2012-7-19), download and
install
4.set path for gs, (computer->mouse right click->content->advanced system setup-
>environment->user variable->add or edit->add path “C:\Program
Files\gs\gs9.05\bin”

want a batch convert on win32? try this


1.copy all encrypted pdf files into a working directory, and create a sub directory
named conv
2.in cmd mode, in this directory type(in quote”): “dir *.pdf /b >conv.txt”
3.create a batch file :conv.bat content as
FOR /F “eol=; usebackq delims==” %%i in (conv.txt) do gswin32c -q -dNOPAUSE -
dBATCH -sDEVICE=pdfwrite -sOutputFile=conv/%%i -c .setpdfwrite -f %%i
4.in cmd mode, in this dir type: “conv”
5.done! all decrypted files will be sent into sub dir”conv”

reply link

annaanan
Oct 23, 2012 @ 6:31

I have a lots of protected pdf files, with your tool, I success open these documents

reply link

https://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/ 15/26
2/3/23, 20:05 HowTo: Linux Remove a PDF File Password Using Command Line Options - nixCraft

pdf password remover mac


Oct 23, 2012 @ 6:32

I have many password protected pdf documents, you software help me open them

reply link

MartinSt
Nov 27, 2012 @ 16:33

I could only remove the password from a file (with probably AES encryption inside)
by using MuPDF. No program mentioned above worked with my file.

mubusy clean -p YOURPASSWORD-HERE input.pdf

This command generates out.pdf without the password.


I used a precompiled windows binary from here together with wine:
http://code.google.com/p/mupdf/downloads/list

reply link

kostadinovic
Dec 2, 2012 @ 21:33

Same here, I tried all the above solutions.


Can you tell me some more about your way. I’m running on win7 and I downloaded
muPDF but I dont know where to put the command

reply link

Pete
May 30, 2013 @ 9:56

If you’re using a newer version of MuPDF (I used the git version from AUR), the
name of the tool has changed to:
mutool clean -p YOUR-PASSWORD input.pdf

https://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/ 16/26
2/3/23, 20:05 HowTo: Linux Remove a PDF File Password Using Command Line Options - nixCraft

Did work for me, cheers!


reply link

Terry
Jan 1, 2013 @ 5:50

qpdf worked. great description!

reply link

Marc
Mar 23, 2013 @ 16:35

What about Excel protected File? How can a person recover a lost password for a
.xsls file … :(
(I’m under macOSx If you have a solution with os command line would be great ;)
otherwise i’ll just install a dual boot linux)

Thank you,

reply link

Kedar
Mar 23, 2013 @ 18:17

Thanks for the tips but here is what I tried (before I came across this site).

I knew the password, but it was a pain to enter it every single time I tried to open the
file. So I just wanted to strip the password and store as a regular PDF. What I did
was:
1. I opened the PDF file in Okular Ver 0.14.3
2. Go to File -> Print
3. Print to a PDF file and gave the name of the output file
I searched everywhere for an option where I could have stripped it of the password,
but there was none.

https://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/ 17/26
2/3/23, 20:05 HowTo: Linux Remove a PDF File Password Using Command Line Options - nixCraft

4. Viola… without anything being done from my side, a new PDF file was created
sans the password protection.

Okular rocks!!!
reply link

Night Owl
Mar 29, 2013 @ 9:50

Without knowing the password the one line with ghost view worked perfectly! (under
Mac OS)

Thanks!

reply link

LMM
Jan 23, 2014 @ 23:34

Only problem with the print-to-pdf versions (evince, okular) of this process is that any
forms, indexes, links, etc. will be removed.

reply link

Rhett Fisher
Feb 12, 2014 @ 7:47

It doesn’t work for me:

gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=unencrypted.p


**** This file requires a password for access.
Error: /invalidfileaccess in pdf_process_Encrypt
Operand stack:

https://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/ 18/26
2/3/23, 20:05 HowTo: Linux Remove a PDF File Password Using Command Line Options - nixCraft

Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --n
Dictionary stack:
--dict:1173/1684(ro)(G)-- --dict:1/20(G)-- --dict:82/200(L)--
Current allocation mode is local
GPL Ghostscript 9.10: Unrecoverable error, exit code 1

reply link

Tommy
Mar 14, 2014 @ 19:40

qpdf worked perfectly. pdftk did not work at all. Thanks for the tips!

reply link

Amol
Mar 31, 2014 @ 8:07

Thanks for the article.

pdftk – did not work with user_pw / input_pw / owner_pw.


pdftops – worked, but lost digital signature of the original pdf.
qpdf – worked, retained the digital signature, great!

reply link

Albert
May 7, 2014 @ 11:50

Hi,
In cygwin (can’t say anything on other platforms), the way you describe pdftk does
not work. The command seems not to be in the right order.
If I do: “pdftk in.pdf output out.pdf input_pw PASSWD”
I always get: OWNER PASSWORD REQUIRED, but not given (or incorrect)

https://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/ 19/26
2/3/23, 20:05 HowTo: Linux Remove a PDF File Password Using Command Line Options - nixCraft

However, it works great moving “input_pw PASSWD” just after in.pdf and before
output command. I mean:
pdftk in.pdf input_pw PASSWD output out.pdf
Works great.
Hope this helps.
reply link

David
Feb 11, 2015 @ 7:54

pdftk input.pdf input_pw PASSWORD output output.pdf


worked for me only if the `input_pw` was before the `output` option

reply link

Richard Ayotte
May 4, 2015 @ 21:35

I had a weird document that was encrypted without a password. The solution was to
decrypt it using qpdf without the password argument.

qpdf –decrypt input.pdf output.pdf

reply link

melchi
Sep 21, 2015 @ 6:29

I found it very useful for my airtel bills and some docs from banks.
the order of parameters matter to pdftk, hence the input_pw should be used before
the output command. Otherwise, the tool does not use the password.

The title is right in my opinion, as that is what came to my mind for googling, when I
needed this.

reply link

https://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/ 20/26
2/3/23, 20:05 HowTo: Linux Remove a PDF File Password Using Command Line Options - nixCraft

Seffent
Nov 9, 2015 @ 13:08

Indeed! For pdftk 2.02 or newer input_pw must be put before output.

reply link

Andrew P.
Feb 23, 2016 @ 23:48

xpdf-utils 3.02 is a stinker; I would recommend caution before proceeding with


installation. On my Ubuntu system, without warning it removed Ghostscript, the
Generic CUPS-PDF Printer driver and CUPS, and messed up the backend files for
my HP LaserJet, leaving my system with no way of printing anything. Fortunately,
when I saw what the xpdf-utils installer had done, I captured the log from the terminal
window and saved it as a text file, so I could use it as a guide to restore what xpdf-
utils had destroyed. In my opinion, xpdf-utils is an ill-behaved POS that doesn’t
belong in any repository. The Xpdf site now shows version 3.04 as the current one,
but I wouldn’t bet that the installer is better-behaved than the one I got from the
Ubuntu repository.

reply link

Craig S
Mar 24, 2016 @ 16:25

Found this for bulk removing passwords

mkdir -p temp && for f in *.pdf ; do qpdf --


password=YOURPASSWORDHERE --decrypt "$f" "temp/$f"; done && mv
temp/* . && rm -rf temp

reply link

Anon

https://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/ 21/26
2/3/23, 20:05 HowTo: Linux Remove a PDF File Password Using Command Line Options - nixCraft

Dec 6, 2020 @ 23:15

The pdftk syntax shown is wrong (at least on the latest Java-based pdftk), and this
likely explains why amol had trouble. The password argument must come right after
the input arguments, *not* at the end after the output arguments as shown.

Correct:
pdftk encrypted.pdf input_pw example_password_here output decrypted.pdf

Incorrect:
pdftk encrypted.pdf output decrypted.pdf input_pw example_password_here

reply link

jonathan swift
Apr 1, 2021 @ 3:04

I wasn’t even looking for this, just stumbled on –Adobe just threw it on the screen
{why?}. Point: I was amazed at
how professional, friendly, polite, respectful, and of course brilliant
all of your comments are.

This is rare among the thousands discussions {blogs} in which insults,


rudness, negativism, aspersions are sprinkled in like pepper on a dinner
plate.

Is there something you all share in common we


should know about, e.g. education, geographics , personality types, DNA,
politics, what do the correlations load on ?

reply link

Michael
Mar 3, 2022 @ 15:26

https://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/ 22/26
2/3/23, 20:05 HowTo: Linux Remove a PDF File Password Using Command Line Options - nixCraft

qpdf made it: TNX.

qpdf --password=MySecret --decrypt input.pdf output.pdf

reply link

Anonymous
May 30, 2022 @ 17:42

The Ghostscript Is very useful!! decrypted it within seconds.


Thanks a lot!

reply link

steve
Jul 30, 2022 @ 18:13

Works!

reply link

Leave a Reply

Your email address will not be published. Required fields are marked *

Comment *

https://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/ 23/26
2/3/23, 20:05 HowTo: Linux Remove a PDF File Password Using Command Line Options - nixCraft

Name

Post Comment

Use HTML <pre>...</pre> for code samples. Your comment will appear only after approval by the

site admin.

Next FAQ: Nginx Force (Redirect) WWW.Domain.COM To Domain.COM

Previous FAQ: Nginx Block And Deny IP Address OR Network Subnets

     

SEARCH

🔎 To search, type & hit enter...

FEATURED ARTICLES

1 30 Cool Open Source Software I Discovered in 2013

2 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X

3 Top 32 Nmap Command Examples For Linux Sys/Network Admins

4 25 PHP Security Best Practices For Linux Sys Admins

https://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/ 24/26
2/3/23, 20:05 HowTo: Linux Remove a PDF File Password Using Command Line Options - nixCraft

5 30 Linux System Monitoring Tools Every SysAdmin Should Know

6 40 Linux Server Hardening Security Tips

7 Linux: 25 Iptables Netfilter Firewall Examples For New SysAdmins

8 Top 20 OpenSSH Server Best Security Practices

9 Top 25 Nginx Web Server Best Security Practices

10 My 10 UNIX Command Line Mistakes

SIGN UP FOR MY NEWSLETTER

➔ Linux shell scripting tutorial

➔ RSS/Feed

https://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/ 25/26
2/3/23, 20:05 HowTo: Linux Remove a PDF File Password Using Command Line Options - nixCraft

➔ About nixCraft

     

©2002-2023 nixCraft • Privacy • ToS • Contact/Email • Corporate patron Linode &


Cloudflare

     

https://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/ 26/26

You might also like