执行.plist文件时出错路径所有权/权限错误 [英] Error while executing .plist file Path had bad ownership/permissions

查看:925
本文介绍了执行.plist文件时出错路径所有权/权限错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在执行terminal

错误:Path had bad ownership/permissions

1)我使用xcode 6创建了一个plist文件,并将该plist文件保存在路径library/launchdaemons/myfile.plist

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)在终端机中,我使用sudo launchctl load命令加载plist文件

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

sudo launchctl load /library/launchdaemons/myfile.plist

3)之后,我得到了这个错误

3) After that i am getting this error

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

我要去哪里错了?

推荐答案

尝试更改.plist文件的所有权,如

Try changing the ownership of the .plist file, as noted here.

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

还值得注意的是,出于安全原因,这些根LaunchDaemons不可在世界范围内写入:

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

sudo chmod o-w /Library/LaunchDaemons/*

这篇关于执行.plist文件时出错路径所有权/权限错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆