Skip to main content
Question

Permissions and Configuration question about creating a package of a script in Composer


Forum|alt.badge.img+8

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.

7 replies

sdagley
Forum|alt.badge.img+25
  • Jamf Heroes
  • 3536 replies
  • August 16, 2022

@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"

 

 


Forum|alt.badge.img+8
  • Author
  • Contributor
  • 41 replies
  • August 16, 2022
sdagley wrote:

@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"

 

 


@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 :-)

 


sdagley
Forum|alt.badge.img+25
  • Jamf Heroes
  • 3536 replies
  • August 16, 2022
psherotov wrote:

@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 :-)

 


@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')


scottb
Forum|alt.badge.img+18
  • Valued Contributor
  • 1285 replies
  • August 17, 2022

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.

 


J_Morgan
Forum|alt.badge.img+4
  • Contributor
  • 19 replies
  • March 6, 2024

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?


sdagley
Forum|alt.badge.img+25
  • Jamf Heroes
  • 3536 replies
  • March 7, 2024
J_Morgan wrote:

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?


@J_Morgan To replicate permissions in Composer click the ... icon to the right of the permissions grid:  


J_Morgan
Forum|alt.badge.img+4
  • Contributor
  • 19 replies
  • March 11, 2024
sdagley wrote:

@J_Morgan To replicate permissions in Composer click the ... icon to the right of the permissions grid:  


Perfect, thanks!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings