Posted on 02-27-2019 06:20 AM
Hi all.
I would like to implement saferm (https://launchpad.net/safe-rm) to prevent accidental deletion of user homes and mounted network drives, just to name a few, via jamf script.
However, if I crackbrainly and accidentally run a jamf script with " rm -rf / " in it, which rm would be actually called by this?
/usr/local/bin/rm?
/usr/bin/rm?
The first mentioned in the /etc/paths file (should be by default /usr/local/bin/rm)?
Any other I do not think about?
I get different results running this command locally and remotely via jamf (after installation of saferm in /usr/local/bin/rm), even if I give the complete path in the script /usr/local/bin/rm).
Any ideas?
Best regards
Christian
Posted on 02-27-2019 06:38 AM
@cbednarzwirecard In your scripts, just use the full path of the binary that you intend to be called, don't just specify rm.
Posted on 02-27-2019 02:25 PM
Ryan's answer is best. Rather than assuming you know the shell and its paths that another account will use, prepending the command with its full path in your scripts lets you call the binary you expect.
To find the path to any binary that comes with a Mac, use which
followed by the command in Terminal:
$ which rm
/bin/rm