0

One of the latest OS upgrades caused a script loaded by launchctl to fail for permissions.

my script does this to mirror a mounted path into my disk:

rsync -av --delete <mounted-path> <local-path>

I have no problem in running it manually, but running from the daemon I'm getting:

building file list ... rsync: opendir "<mounted-path>." failed: Operation not permitted (1)

I'm quite sure that I need to provide permission to the script, but couldn't find a way to grant the permission from System Prefs -> Security & Privacy -> Privacy -> Files and Folders. The [+/-] there is grayed off...

Any idea please?

EDIT: more data:

My plist: (com.mycompany.update-folder-from-nfs.plist)

<?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.mycompany.update-folder-from-nfs</string>
    <key>ProgramArguments</key>
    <array>
        <string>/Users/myname/Prog/something/uz-cpu/update_from_nfs_using_rsync.sh</string>
    </array>
    <key>StartInterval</key>
    <integer>45</integer>
</dict>
</plist>

Loading the plist:

launchctl unload ~/Library/LaunchAgents/com.mycompany.update-folder-from-nfs.plist || echo "ok"
cp com.mycompany.update-folder-from-nfs.plist ~/Library/LaunchAgents/
launchctl load ~/Library/LaunchAgents/com.mycompany.update-folder-from-nfs.plist
4
  • When you run it, do you run it as you or as root? Are the paths absolute or relative? LaunchAgents and Launch Daemons don’t need permissions they run as either a user you specify or as root which already have permissions. How are they being executed?
    – Allan
    Jun 22, 2020 at 17:11
  • Already checked that by writing log to file. The user is myself.
    – ishahak
    Jun 22, 2020 at 17:57
  • It might be best to post the plist and show how you’re loading it. We can then get a better picture
    – Allan
    Jun 23, 2020 at 2:31
  • added the plist as requested. thanks!
    – ishahak
    Jun 23, 2020 at 6:57

0

You must log in to answer this question.

Browse other questions tagged .