Permission denied problem

I’m trying to do this…

set printersConf to do shell script “grep ‘<Printer’ /private/etc/cups/printers.conf”

… but of course I get a “Permission denied” error. Anybody know another way to return this info? Or a way around the permission problem?

Thanks

Two options come to mind.

First, if you’re an admin on your machine, you can just:

do shell script “grep ‘<Printer’ /etc/cups/printer.conf” with administrator privileges

This will prompt you for your password then use sudo to execute the command.

If you want the script to be run by non-admins on the machine then change the permissions of the file so anyone can read it:

chmod a+r /etc/cups/printer.conf

Although this approach may have unexpected results, and may be reset by cups the next time you edit your printer list.