-1

I'm fairly new to MAC and the Terminal and I want to send out a script on a larger scale to MAC-computers that basically:

  1. Creates a script that disables the awdl0 interface
  2. Create a plist that should run whenever a user restarts their computer or the computer wakes from sleep.

However, when trying the script locally on the MAC, it seems that the Daemon status codes it set to 78, which there isn't alot of info about (that I can see atleast).

The script looks like this:

#!/bin/bash
echo '#!/bin/bash
sudo ifconfig awdl0 down' > ./disable_awdl_test.sh
sudo chmod +x ./disable_awdl_test.sh
sudo mv ./disable_awdl_test.sh /Users/admin
echo '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.disableawdl.test</string>
    <key>ProgramArguments</key>
    <array>
        <string>/Users/admin/disable_awdl_test.sh</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>StandardOutPath</key>
    <string>/tmp/com.disableawdl.out</string>
    <key>StandardErrorPath</key>
    <string>/tmp/com.disableawdl.err</string>
</dict>
</plist>
' > ./com.disableawdl.test.plist

sudo chown root:wheel ./com.disableawdl.test.plist
sudo chmod 644 ./com.disableawdl.test.plist
sudo mv ./com.disableawdl.test.plist /Library/LaunchDaemons

sudo launchctl load /Library/LaunchDaemons/com.disableawdl.test.plist

Can someone see what the issue might be here? The .out and .err doesn't seem to be working either, since they are only empty files. As I said, I'm really new to MAC and so on. There might even be an easier way to accomplish this?

  • You should post this question on https://unix.stackexchange.com/ or https://superuser.com/ . BTW, the target script is in a home directory that even root might not be able to access when SIP is enabled – Fravadona Aug 31 '23 at 08:43

0 Answers0