Posted on 08-16-2022 08:48 AM
Hello all,
Here's the scenario, I want to install a script in /Library/Scripts on a computer and I want the script to work :-)
What permissions do I need to set to ensure it will work?
I'm aware of the chmod u+x terminal command to make it executable. After running that command the permissions were listed as -rwxr--r--
However a different script that was successfully packaged and installed using the composer method has different permissions: -rwxr-xr-x Also the owner is root...
Do I need to change/set the owner to root in Composer? And do I need to change the permissions?
Added info for the specific script I had a plist file in LaunchAgents to call the script.
08-16-2022 11:23 AM - edited 08-16-2022 11:24 AM
@psherotov If the script is going to be called from a LaunchAgent then the calling context will be the logged in user and you'll want to set the following permissions (this is an excerpt from a post install script):
/usr/sbin/chown root:admin "/Library/Scripts/script.sh"
/bin/chmod 755 "/Library/Scripts/script.sh"
Posted on 08-16-2022 11:51 AM
@sdagley Thank you for the information! Forgive my ignorance but what does the /usr/sbin/ and /bin/ mean in the context of your snippets? I see it a lot, for me I usually cd to the directory and then type in the commands or drag and drop the script into terminal and then run the commands. I'm sure I'm missing something, I just don't know what :-)
Posted on 08-16-2022 12:29 PM
@psherotov I used the full path for the executable that will be run when the chown or chmod commands are used. The built-in shell command 'which' will return the path to a command (e.g. 'which chown' returns '/usr/sbin/chown')
Posted on 08-17-2022 09:27 AM
As an aside, if you're using Composer, you can also set file ownership/permissions in there before you build the pkg/dmg.
I just dragged one in to show the checkboxes on the lower, right corner.
Posted on 03-06-2024 02:16 PM
Am I missing something – is the only way in Composer to set ownership/permissions to set them individually for each file and folder or is there a way to set them recursively on a folder and have them inherited by subfolders and files within?
03-06-2024 07:50 PM - edited 03-06-2024 07:54 PM
@J_Morgan To replicate permissions in Composer click the ... icon to the right of the permissions grid:
Posted on 03-11-2024 07:34 AM
Perfect, thanks!