Change Permissions and Move file

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

Moderator: Mr_Noodle

Change Permissions and Move file Mon Apr 10, 2017 5:11 pm • by cholder
Hi

I have a spot that files are downloaded from the internet RSS feed, and then that file is in turn loaded into a program to be actioned. It seems the last apple update broke permissions.

I am trying to use Hazel to change the permissions to the correct setting for the program to be able to use the file.

I have a file in a folder called test permissions.
the Hazel script calls a script in this folder (~/Desktop/testpriv/changePer.sh)

It's a very simple script

*************
#!/bin/sh

sudo chown -R username:staff /Users/crholder/Desktop/From\ Internet

**********
it was returning this error from the hazel logs
Shellscript exited with non-successful status code: 126

I modified the script to be executable and now it returns this
Shellscript exited with non-successful status code: 1

Any help would be appreciated.
cholder
 
Posts: 2
Joined: Mon Apr 10, 2017 5:03 pm

Re: Change Permissions and Move file Tue Apr 11, 2017 11:13 am • by Mr_Noodle
Note that "sudo" may require you to enter a password, which Hazel cannot do for you. You'd need to do something like using a setuid bit on the script instead, which is very unsafe and not recommended.
Mr_Noodle
Site Admin
 
Posts: 11880
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Change Permissions and Move file Fri Apr 14, 2017 4:10 pm • by cholder
Tried taking the sudo out, still won't run

Is there another way to set permissions?
cholder
 
Posts: 2
Joined: Mon Apr 10, 2017 5:03 pm

Re: Change Permissions and Move file Mon Apr 17, 2017 10:37 am • by Mr_Noodle
You have to also setuid it to run as root. Search around on how to do that. Again, though, it's a potential security hole so make sure you read up on it fully.
Mr_Noodle
Site Admin
 
Posts: 11880
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support

cron