Error while executing .plist file Path had bad ownership/permissions

TerminalPlist

Terminal Problem Overview


Getting a error while executing the plist file in terminal

ERROR : Path had bad ownership/permissions

  1. I created a plist file using xcode 6 and saved the plist file in path library/launchdaemons/myfile.plist

myfile.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>myfile</string>
	<key>ProgramArguments</key>
	<array>
		<string>/Desktop/myscript.sh</string>
	</array>
	<key>StartCalendarInterval</key>
	<array>
		<dict>
			<key>Hour</key>
			<integer>14</integer>
			<key>Minute</key>
			<integer>35</integer>
		</dict>
	</array>
</dict>
</plist>

2) In terminal i used the sudo launchctl load command to load the plist file

sudo launchctl load /library/launchdaemons/myfile.plist

3) After that i am getting this error

/Library/LaunchDaemons/myfile.plist: Path had bad ownership/permissions

Where i am going wrong ?

Terminal Solutions


Solution 1 - Terminal

Try changing the ownership of the .plist file:

sudo chown root /Library/LaunchDaemons/myfile.plist
sudo chgrp wheel /Library/LaunchDaemons/myfile.plist

or more simply, change the user and group in one command:

sudo chown root:wheel /Library/LaunchDaemons/myfile.plist

It is also worth noting that these root LaunchDaemons can't be world writable, for security reasons:

sudo chmod o-w /Library/LaunchDaemons/*

Solution 2 - Terminal

The plist file must be owned by root and group wheel as rw only for owner. So root:wheel 600

Solution 3 - Terminal

In addition to the above

sudo chmod 600 /directoryToFile/filename.plist

for example:

sudo chmod 600 com.backup.plist

or

sudo chmod 600 /Library/LaunchDaemons/myfile.plist

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionvivekView Question on Stackoverflow
Solution 1 - TerminalfiveclubsView Answer on Stackoverflow
Solution 2 - TerminalLuc-OlivierView Answer on Stackoverflow
Solution 3 - TerminalLian BondView Answer on Stackoverflow