Skip to main content
Question

Pushing Scripts via Capser Remote


Forum|alt.badge.img+19

Dumb question...

When pushing out bash scripts that require root privileges via Casper Remote, do I need to explicitly escalate permisions via the sudo command?

Simple Example: I created a simple bash script to tell managed Macs to run Apple Software Update...

Is this acceptable:

!/bin/bash

/usr/sbin/softwareupdate -i -a

Or do I need to do this:

!/bin/bash

sudo /usr/sbin/softwareupdate -i -a

I assume jamf runs as root?

5 replies

mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • February 3, 2016

It should be running them as root, same as it would when running from a policy, but since I probably only use Casper Remote like once a year at best, you may want to test it to be sure.


Forum|alt.badge.img+19
  • Author
  • Valued Contributor
  • 568 replies
  • February 3, 2016

Thank you sir. I just started (seriously) playing with Casper Remote today. Wondered if "sudo" was redundant or not.


stevewood
Forum|alt.badge.img+35
  • Employee
  • 1797 replies
  • February 3, 2016

It is redundant. Casper Remote actually creates hidden policies in the JSS and runs the commands like a policy. So whether you use a policy or Casper Remote, you're doing the same thing.


Forum|alt.badge.img+15
  • Contributor
  • 589 replies
  • February 3, 2016

Casper remote does run via policies. It creates a hidden policy, tells the client to execute it, then removes that policy. There was a post here about a month or so ago describing how it works internally. So Casper Remote or Policy all run the same.

sudo is certainly redundant. All scripts execute as root. Additionally, as you may know, many environment variables are skipped. That means you should set the full path to commands in your script, such as instead of 'launchctl list', you'd use '/bin/launchctl list'.


mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • February 3, 2016

Yeah, the post describing how Casper Remote works may have been this one? https://jamfnation.jamfsoftware.com/featureRequest.html?id=4343#responseChild13197 From me ironically enough, although maybe it was a different one.
Anyway, yes, it runs stuff as root, because it really is just executing a policy in the end.


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