Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.6: Remove passwords from edit-restricted PDFs System 10.6
Snow Leopard only hintFour years ago, I wrote a hint about how to remove a PDF password using ColorSync from those PDF files than you can view, but not copy or change. It did not apply to files that were encrypted with a password and could not be opened.

To my surprise, it has been one of the more popular hints, with over 112,000 hits. However, since Tiger, Apple has progressively tightened the PDF DRM, so that the hint does not work in Snow Leopard any more. There are several third party programs that will do it, but here's how to do it in Snow Leopard for free.

Note that this hint will not decrypt PDF files that cannot be opened without a password.

The following do not work: copying the old ColorSync from Tiger, using a virtual CUPS-PDF printer, trying to print as PDF, and dropping the PDF onto a Pages or a Keynote document to create another PDF.

Assuming you can print the file and you have administrator rights, here is one simple way to defeat this DRM.
  1. In Finder, press Shift-Command-G, or select Go » Go to Folder....
  2. Type /var/spool and press Return.
  3. The spool folder will open, and inside there will be several folders. The cups folder will have a red Stop sign on it.
  4. Select it, and then press Command-I (or use File » Get Info).
  5. In the Sharing & Permissions section of the Get Info window (at the bottom), click the lock to open. You will need your administrator password.
  6. Now click the "+" sign and add yourself to the list. You only need 'read only' privileges.
  7. Now open the cups folder.
Alternatively, fire up Terminal, and type sudo chmod +r /var/spool/cups (press Return) and then open /var/spool/cups (Return again) to achieve all of the above steps. Either way, once that's done, do this...
  1. View the cups folder as a list (View menu) and sort by Date Modified.
  2. Open up your favorite PostScript printer by going to Print and Fax in System Preferences and selecting it from the list on the left. If you don't have one, install one.
  3. Pause the printer.
  4. Print your PDF to this printer. It will complain that the printer is paused. Click Add to Queue and not Resume.
  5. The print file will show up in the cups folder at the top with an obscure name like d00023-001 (ignore the corresponding file c00023).
  6. Drag this print file to your Desktop (or wherever). You will need your administrator password again.
  7. Add .pdf to the end of the file name, and open with Preview.
  8. Delete the print job in your PostScript printer.
But what if the file has DRM that does not allow it to be printed? There is probably a way to copy it from Display PDF or the Quartz engine. If someone knows, please post. Alternatively, you can install another PDF engine like Ghostscript. Scroll down the comments on this hint to see how to do that.

But what if Apple closes this loophole? Just set your printer to save the file after it prints, and then download it back to your computer! See this discussion for more on that subject.
    •    
  • Currently 3.00 / 5
  You rated: 4 / 5 (26 votes cast)
 
[37,155 views]  

10.6: Remove passwords from edit-restricted PDFs | 17 comments | Create New Account
Click here to return to the '10.6: Remove passwords from edit-restricted PDFs' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.6: Remove passwords from edit-restricted PDFs
Authored by: emanhaud on Feb 24, '10 07:50:05AM

I have done this quite a bit recently, but my method is to open the PDF in Preview and resave from within Preview. I don't not use PDF extensively so there may be downsides to my method, but it does allow me to open the PDF in Illustrator or Acrobat and make changes.



[ Reply to This | # ]
10.6: Remove passwords from edit-restricted PDFs
Authored by: mmnw on Feb 24, '10 08:08:59AM

Very good hint. Just tried it and it works perfectly. This has annoyed me for some time.

Although it should be noted, changing permissions on /var/spool/cups may not be a good idea in a security oriented environment. It would mean, every user on the computer could theoretically monitor what everyone else is printing.
(Well, I guess in a secured environment you wouldn't know the admin password anyway ).



[ Reply to This | # ]
pdfauxinfo
Authored by: pietrodn on Feb 24, '10 08:33:53AM

I've found a nice app: pdfauxinfo

It can put passwords and permissions on a PDF file, but it can also remove all the protections and passwords from the PDF! It obviously won't crack read-protected PDFs. But it does on print-protected and copy-protected ones.

I've created a simple Automator workflow that unprotects PDF files. I checked the "permit copying" and the "permit printing" options, and left the remaining fields blank.



[ Reply to This | # ]
10.6: Remove passwords from edit-restricted PDFs
Authored by: kamath on Feb 25, '10 01:00:39AM
This trick works well, but I have issues with the original steps. Here's a slightly simpler set of steps:
  1. Pause Printer
  2. Print Document
  3. open terminal, and type the following:
    sudo -s
    (enter your password)
    cd /var/spool/cups
    ls
    (look for file that starts with 'd')
    cp file ~/Desktop/.pdf
    chown $SUDO_USER ~/Desktop/.pdf
    exit
    Replace file with the name of the file that starts with 'd'.
  4. delete print job from the printer list and resume the printer.
It is a stunningly bad idea to change the permissions on system directories, like /var/spool/cups. This avoids changing any permissions (save the file you're copying), and limits your exposure to doing anything as root (you must be root to look in /var/spool/cups, otherwise it would be reduced to a single sudo cp ...). I could avoid chowning the file, but it would be icky and everyone would just accuse me of being a unix greybeard.

[ Reply to This | # ]
10.6: Remove passwords from edit-restricted PDFs
Authored by: mubarak on Feb 25, '10 08:34:52PM

kamath, as mmnw pointed out, the security implications are minimal in changing the permissions on /var/spool/cups. If you are concerned, you can always change them back, or run Disk Utility to fix permissions.

The idea was show that most PostScript drivers will remove DRM and to use the Finder rather than the command line to do it in a step by step manner. However, if you would rather use the command line, most good hints can be reduced to just one line of code. Pause the printer, print to its queue, type the following in Terminal:

sudo mv `sudo ls /var/spool/cups | grep d | sed 's_d_/var/spool/cups/d_'` ~/nopassword.pdf ; sudo chmod +r ~/nopassword.pdf

and authenticate with your password.

This will create a readable file called nopassword.pdf in the home folder, and will also remove the file from the print queue.

Cheers!



[ Reply to This | # ]
10.6: Remove passwords from edit-restricted PDFs
Authored by: CarlRJ on Feb 26, '10 07:40:09PM
My first thought was, you could fold the grep into the sed and save one command, but then I realized that xargs could simplify things and handle multiple files in the queue as well:
sudo -s "cd /var/spool/cups; /usr/sbin/chown -v `id -u`:`id -g` d* | xargs -I@ mv -iv @ ~/Desktop/nopassword_@.pdf"
I think it's also preferable to have the file end up owned by the user, instead of them merely having read access to it.

[ Reply to This | # ]
10.6: Remove passwords from edit-restricted PDFs
Authored by: mubarak on Feb 27, '10 02:40:52PM

Thanks, CarlRJ! Your solution is more elegant. I had aliased the command I had posted in my .login file as pdfpass. I will replace it with yours.

Now the hint is one sentence only. Pause a PostScript printer, print to add to its queue, type pdfpass in Terminal, and authenticate.



[ Reply to This | # ]
10.6: Remove passwords from edit-restricted PDFs
Authored by: newpolluter on May 25, '10 09:22:19PM

Hi everyone,

Been coming here a long time and never posted; thanks to the community for all the help over the years. Anyway, I had a really nasty PDF that wouldn't let me do hardly anything to it, and when I tried pietrond's pdfaux info trick it generated blank pages for me (for whatever reason), and I like to find non-command line solutions when I can (if only as a challenge). So, I tried this really simple Automator workflow, and it suprisingly worked: just render the pdf pages as images, and then gather them back up and create a new pdf. I'd be interested to know if this works for other people. You do get a MASSIVE increase in file size (3-4x), but tricks for reducing pdf file sizes have been well-covered. Here's the workflow:

-Ask for Finder Items
-Render PDF Pages as Images
-Copy Finder Items
-Make Finder Item Names Sequential
-Get Selected Finder Items
-New PDF from Images



[ Reply to This | # ]
using automator to crack pdf pswd
Authored by: techwriter on May 28, '10 08:20:07PM

<strong>newpolluter</strong> - many thanks for this, it worked a treat for me. It also introduced me to Automator, which I'd never looked at before.

Just one clarification for any other newbie like me: to add the 'make finder items sequential' you must:

i. search for the 'Rename Finder Items' action in Automator,
ii. drag 'Rename Finder Items' to the workflow
iii. in the workflow dialog box for this action, choose 'make sequential' from the drop down menu.



[ Reply to This | # ]
cracking tips?
Authored by: tedw on May 29, '10 08:43:18AM
People put security on a PDFs to ensure intellectual property rights, forestall plagiarism, and prevent people from taking snippets of the document out of context. I'm sorry if it inconveniences you, but cracking the password is not the correct (read that as adult) way to resolve the situation. Send an email to the PDF author asking for the sections you want. Really, I'm surprised that the moderators allowed a cracking tip into the forum. I thought OSXHints forum rules prohibited that.

[ Reply to This | # ]
Broken as of 10.6.4
Authored by: mcritz on Jun 21, '10 06:56:35PM

Unless I'm doing this wrong, this looks broken as of OS 10.6.4

---
www.michaelcritz.com



[ Reply to This | # ]
Broken as of 10.6.4
Authored by: aptmunich on Jul 05, '10 12:09:20PM

Still works fine for me...
-> Doing it wrong? :)



[ Reply to This | # ]
10.6: Remove passwords from edit-restricted PDFs
Authored by: ehunt123 on Jun 23, '10 05:48:03AM

Since apple's own tools vary on how they "respect" the password part, since I gathered this was like an RFC where an application could just ignore not issuing it and the pdf itself lacked DRM, so it would view.

There are a few commercial apps out there that I would assume use a similar method to the cli/os tool here:

http://sourceforge.net/projects/pdfcrack/



[ Reply to This | # ]
Broken as of 10.6.4
Authored by: mcritz on Jul 05, '10 02:23:56PM

Yeah. I was able to do it from the command line.

---
www.michaelcritz.com



[ Reply to This | # ]
Broken as of 10.6.4
Authored by: sgweit on Jan 19, '11 12:01:36PM

I did this easily and did not have to follow the last set of instructions.

Once I opened my cups folder I opened Distiller and dragged the file from the cups folder to Distiller.
Distiller saved the new pdf to my desktop and it was without any security.

:)



[ Reply to This | # ]
10.6: Remove passwords from edit-restricted PDFs
Authored by: sgweit on Jan 19, '11 11:57:52AM

EASIER THAN EXPECTED: I did it but did not have to follow the last set of steps.
After I opened the cups folder I simply opened Adobe Distiller and then dragged the file from my cups folder to the distiller window.

It saved it to my desktop without any security.

Life is good!



[ Reply to This | # ]
10.6: Remove passwords from edit-restricted PDFs
Authored by: m2a2b2 on Oct 31, '12 12:30:21PM
The old hint still works in Mountain Lion with one minor change.
  1. Open the restricted PDF in ColorSync.
  2. Choose File: Print..., then PDF: Save as PDF..., and name it whatever you like
  3. Open the saved file in Adobe Reader or Preview and enjoy!
There is another easy way in Mountain Lion.
  1. Open the restricted file in Preview
  2. Choose File: Save..., and name it whatever you like
  3. Open the saved file in Adobe Reader or Preview and enjoy!


[ Reply to This | # ]