How to remove password from PDF file

Questions about applications and software
Forum rules
Before you post please read how to get help
McNooby
Level 1
Level 1
Posts: 6
Joined: Mon Sep 18, 2017 3:29 am

How to remove password from PDF file

Postby McNooby » Wed Dec 06, 2017 3:32 am

Is it possible to remove the password from a PDF file on Linux Mint 18.2 Sonya (64 bit)? If so, how do I go about doing it?

System details:

Code: Select all

System:    Host: jonathan-Aspire-ES1-523 Kernel: 4.10.0-40-generic x86_64 (64 bit gcc: 5.4.0)
           Desktop: Cinnamon 3.4.6 (Gtk 3.18.9-1ubuntu3.3)
           Distro: Linux Mint 18.2 Sonya
Machine:   Mobo: Acer model: TRICERA_CZL v: V1.02
           Bios: Insyde v: V1.02 date: 09/19/2016
CPU:       Quad core AMD A4-7210 APU with AMD Radeon R3 Graphics (-MCP-) cache: 8192 KB
           flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm) bmips: 14372
           clock speeds: max: 1800 MHz 1: 1200 MHz 2: 1200 MHz 3: 1600 MHz
           4: 1000 MHz
Graphics:  Card: Advanced Micro Devices [AMD/ATI] Mullins [Radeon R3 Graphics]
           bus-ID: 00:01.0
           Display Server: X.Org 1.18.4 drivers: ati,radeon (unloaded: fbdev,vesa)
           Resolution: 1366x768@59.97hz
           GLX Renderer: Gallium 0.4 on AMD MULLINS (DRM 2.49.0 / 4.10.0-40-generic, LLVM 4.0.0)
           GLX Version: 3.0 Mesa 17.0.7 Direct Rendering: Yes
Audio:     Card-1 Advanced Micro Devices [AMD] FCH Azalia Controller
           driver: snd_hda_intel bus-ID: 00:14.2
           Card-2 Advanced Micro Devices [AMD/ATI] Kabini HDMI/DP Audio
           driver: snd_hda_intel bus-ID: 00:01.1
           Sound: Advanced Linux Sound Architecture v: k4.10.0-40-generic
Network:   Card-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
           driver: r8169 v: 2.3LK-NAPI port: 2000 bus-ID: 01:00.0
           IF: enp1s0 state: down mac: <filter>
           Card-2: Qualcomm Atheros Device 0042
           driver: ath10k_pci bus-ID: 02:00.0
           IF: wlp2s0 state: up speed: N/A duplex: N/A mac: <filter>
Drives:    HDD Total Size: 256.1GB (19.0% used)
           ID-1: /dev/sda model: KINGSTON_RBUSC18 size: 256.1GB
Partition: ID-1: / size: 228G used: 39G (18%) fs: ext4 dev: /dev/sda1
           ID-2: swap-1 size: 7.48GB used: 0.00GB (0%) fs: swap dev: /dev/sda5
RAID:      No RAID devices: /proc/mdstat, md_mod kernel module present
Sensors:   System Temperatures: cpu: 46.0C mobo: N/A gpu: 48.0
           Fan Speeds (in rpm): cpu: N/A
Info:      Processes: 218 Uptime: 50 min Memory: 2199.3/6936.5MB
           Init: systemd runlevel: 5 Gcc sys: 5.4.0
           Client: Shell (bash 4.3.481) inxi: 2.2.35
Last edited by Moem on Wed Dec 06, 2017 4:08 am, edited 1 time in total.
Reason: Adding [code] tags instead of quote tags. They retain some formatting that makes your output easier to read.

aes2011
Level 4
Level 4
Posts: 391
Joined: Wed Jul 06, 2011 10:39 pm

Re: How to remove password from PDF file

Postby aes2011 » Wed Dec 06, 2017 5:41 am

I use qpdf. Assuming you know the password and you're in the folder containing the password-protected file

Code: Select all

qpdf --password=whatever --decrypt protected.pdf open.pdf

Cosmo.
Level 22
Level 22
Posts: 16070
Joined: Sat Dec 06, 2014 7:34 am

Re: How to remove password from PDF file

Postby Cosmo. » Wed Dec 06, 2017 6:51 am

The first question is, if this is legally doable. I doubt that, because it appears unlikely, that the author / distributor has encrypted the file without reason.

aes2011
Level 4
Level 4
Posts: 391
Joined: Wed Jul 06, 2011 10:39 pm

Re: How to remove password from PDF file

Postby aes2011 » Wed Dec 06, 2017 7:08 am

Cosmo. wrote:The first question is, if this is legally doable. I doubt that, because it appears unlikely, that the author / distributor has encrypted the file without reason.

I receive several password-protected files relating to my investments, banks, and taxes. The passwords are some combination of my personal details. Once I decrypt the files, I can subsequently open them without the password. I can also send the decrypted files to my accountant. I'm not sure there's any illegality involved.

User avatar
administrollaattori
Level 12
Level 12
Posts: 4403
Joined: Tue Sep 03, 2013 4:51 am
Location: Finland
Contact:

Re: How to remove password from PDF file

Postby administrollaattori » Wed Dec 06, 2017 10:54 am

Open the PDF and save it using a different name.

User avatar
BenTrabetere
Level 4
Level 4
Posts: 491
Joined: Sat Jul 19, 2014 12:04 am
Location: Hattiesburg, MS USA

Re: How to remove password from PDF file

Postby BenTrabetere » Wed Dec 06, 2017 12:40 pm

Cosmo. wrote:The first question is, if this is legally doable.

As I understand it, in most countries it is legal to use a password crackers to break the the security on a PDF file IF you have permission to do so. For example, it would be legal to recover a password to a PDF you encrypted, but it would be illegal to to bypass the Owner/Open password if you were not an authorized user.

If the OP has a password protected PDF, and knows the password but wants to remove it, qpdf does the trick nicely. The security settings can also be edited with MasterPDF Editor. But you need to know the password.

If the OP is looking for a tool to recover a forgotten password, I suggest PDFCrack. As for legal, the developer states: The only supported usage of PDFCrack is, and will be, to recover passwords and/or content that you own but have lost access to. See http://pdfcrack.sourceforge.net/faq.html

Code: Select all

sudo apt install pdfcrack


I have used PDFCrack to recover passwords, and it works. Typically, the only time I password protect a PDF it is a Owner/Permission password - anyone can open the file, but a password is needed to modify, print, copy, text or extract images. I used it as an obstacle to prevent someone from messing up my PDF or misusing my work (I once had a co-worker with a reputation for plagiarism). My passwords were too short and obvious to be a serious security feature.

Do not expect instantaneous results with PDFCrack - the longer the password, the longer it will take. A long password can take days to crack.

aes2011
Level 4
Level 4
Posts: 391
Joined: Wed Jul 06, 2011 10:39 pm

Re: How to remove password from PDF file

Postby aes2011 » Wed Dec 06, 2017 12:47 pm

BenTrabetere wrote:...
If the OP has a password protected PDF, and knows the password but wants to remove it, qpdf does the trick nicely. ...

That's the scenario I addressed, not hacking or cracking.

Mute Ant
Level 12
Level 12
Posts: 4358
Joined: Tue Sep 03, 2013 7:45 pm

Re: How to remove password from PDF file

Postby Mute Ant » Wed Dec 06, 2017 3:34 pm

"I once had a co-worker with a reputation for plagiarism" Weird, I had exactly the same thing.

If I wanted to start a PDF from fresh, I would view it in Firefox and 'Print to PDF'.

My amateur understanding of encryption and law is that it's similar to breaking into a house. It's criminal to break into a house, even if you are the owner. That allows a constable to arrest anyone breaking into a house without needing special permission. Similarly, it's criminal to guess the password of encrypted data, even if it's your data, even if the guesses don't work.
echo "c 13 o 6 9 * p q" | dc

User avatar
BenTrabetere
Level 4
Level 4
Posts: 491
Joined: Sat Jul 19, 2014 12:04 am
Location: Hattiesburg, MS USA

Re: How to remove password from PDF file

Postby BenTrabetere » Thu Dec 07, 2017 1:00 am

Mute Ant wrote:"I once had a co-worker with a reputation for plagiarism" Weird, I had exactly the same thing.

My co-worker not only stole my work and took credit for it, one time he did such a sloppy job of it he made the same inexcusable spleling errors that I had made. He then had the audacity to accusing me of setting him up to look foolish. Yeah, he was a B-Ark candidate.

As for PDF encryption and the law, my amateur understanding is it depends on ownership and permissions. And, to a degree, intent. On the other hand, all too often Dicken's Mr. Bumble assertion on the law is accurate.

McNooby
Level 1
Level 1
Posts: 6
Joined: Mon Sep 18, 2017 3:29 am

Re: How to remove password from PDF file

Postby McNooby » Thu Dec 07, 2017 7:26 am

Crud... I forgot to mention the context of this request. My bad. :oops:

I made a PDF with a password built into it back in University, and I want to remove said password as it no longer needs to be encrypted. I can't even remember why it had to be password protected. I think it was part of the assignment. Removing it on a Windows machine would be easy enough, but I am trying to use Linux as much as possible now that I switched to it.

aes2011
Level 4
Level 4
Posts: 391
Joined: Wed Jul 06, 2011 10:39 pm

Re: How to remove password from PDF file

Postby aes2011 » Thu Dec 07, 2017 8:17 am

McNooby wrote:Crud... I forgot to mention the context of this request. ...

You still haven't mentioned if you have the password :?:

McNooby
Level 1
Level 1
Posts: 6
Joined: Mon Sep 18, 2017 3:29 am

Re: How to remove password from PDF file

Postby McNooby » Wed Dec 13, 2017 11:24 pm

Yes, I have the password. Sorry for the multiple brain farts.


Return to “Software & Applications”