Any way to run Hazel as root/admin?

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Any way to run Hazel as root/admin? Thu Jan 31, 2013 5:53 pm • by Jefferson
I'm trying to move folders from /Library/WebServer/Documents into the trash after a certain date (they are logs), but they are owned by _www, so Hazel can't move them. Any way to give the app higher privileges?
Jefferson
 
Posts: 1
Joined: Thu Jan 31, 2013 5:51 pm

Re: Any way to run Hazel as root/admin? Fri Feb 01, 2013 1:07 pm • by Mr_Noodle
You would have to run as that user, which I would not recommend. You should instead look into setting up groups, setting the files/folders in question to be group writable and put yourself in that group. It's dangerous to have Hazel (or any process) running permanently with escalated privileges.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

I have a legitimate cause to do this, and understand the risk. How do I do it?
AllAmericanGeek
 
Posts: 2
Joined: Tue Feb 05, 2013 1:17 pm

Re: Any way to run Hazel as root/admin? Tue Feb 05, 2013 2:07 pm • by a_freyer
The point is that all of OSX security is working against you. The very definition of malware is a program that exceeds is permissions. Now obviously Hazel is not malware, but the system doesn't know that.

Look into what Mr_Noodle suggested - permission groups for the www folder (or whatever folder @AllAmericanGeek needs). And add yourself to that group.

You can also setuid() of the hazel processes, but again the system is going to prevent you every way it can.

... I suggest rethinking your workflow if you require a third party program to modify permissions-protected files.
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

Re: Any way to run Hazel as root/admin? Wed Feb 06, 2013 12:07 pm • by AllAmericanGeek
I understand.

I run a DaisyDisk scan as Administrator, and delete out /private/var/vm/sleepimage as well as /.MobileBackups/Computer/* on a regular basis. I'd like to automate that process leveraging Hazel, except I cannot because Hazel does not have administrative permissions to delete the files.

How you suggest I rethink my workflow?

UPDATE: I changed the folder permissions and Hazel functions as planned.
AllAmericanGeek
 
Posts: 2
Joined: Tue Feb 05, 2013 1:17 pm

Re: Any way to run Hazel as root/admin? Wed Feb 06, 2013 1:06 pm • by a_freyer
AllAmericanGeek wrote:UPDATE: I changed the folder permissions and Hazel functions as planned.


I do think this is the best solution, but it is possible that folder permissions correction in the future will set the permissions back.

Now, for the workflow question:

Well, as far as the sleepimage is concerned, if you're deleting it regularly perhaps you should change the hibernation/sleep behavior of your mac.

If, however, you don't want to do this, then I suggest running an applescript to remove the image, with administrator privileges:

Code: Select all
do shell script "rm rm /private/var/vm/sleepimage" with administrator privileges


Of course this will ask your password every time, but if you're only doing this now and then it might not be that much of an irritation.
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado


Return to Support