Running 9.81, and trying to place an Applescript in Self Service that at one point runs:
do shell script "chown -R " & user_name & ":admin /Users/" & user_name & "" with administrator privileges
This portion of the script runs successfully when testing from Script Editor, but as soon as I test from a Self Service policy it fails without any usable error code.
I created a test Self Service policy that exclusively runs this command (as a shell script within an Applescript) and it still fails - I even removed the variable username and just put a username there in plain text. This command runs fine as a shell script in a Self Service policy - it's just when it is within an Applescript that it fails. I'm at a loss for why it works in Script Editor but not as a Self Service policy other than maybe something to do with the user the Self Service policy runs as...
I would just break this piece out into a separate shell script, but I'm passing around variables that are much more practical to contain all in one AppleScript script. Anyone else have any ideas on this - or run into something similar with chown's stubbornness when run within an Applescript?