在plist
terminal
文件时出错
错误:Path had bad ownership/permissions
1)我使用xcode 6
创建了一个plist文件,并将plist文件保存在路径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)在终端中,我使用sudo launchctl load
命令加载plist
文件
sudo launchctl load /library/launchdaemons/myfile.plist
3)之后我收到此错误
/Library/LaunchDaemons/myfile.plist: Path had bad ownership/permissions
我哪里出错了?
答案 0 :(得分:68)
尝试更改.plist文件的所有权,如上所述here。
sudo chown root /Library/LaunchDaemons/myfile.plist
sudo chgrp wheel /Library/LaunchDaemons/myfile.plist
或更简单地说,在一个命令中更改用户和组:
sudo chown root:wheel /Library/LaunchDaemons/myfile.plist
值得注意的是,出于安全原因,这些根LaunchDaemons
无法进行全局写入:
sudo chmod o-w /Library/LaunchDaemons/*
答案 1 :(得分:6)
plist文件必须由root和group wheel归为rw,仅供所有者使用。 所以root:wheel 600
答案 2 :(得分:1)
这对我有用:
sudo chmod 600 /directoryToFile/filename.plist
例如:
sudo chmod 600 com.backup.plist
或
sudo chmod 600 /Library/LaunchDaemons/myfile.plist