【问题标题】:ANT setting ACL permissionsANT 设置 ACL 权限
【发布时间】:2013-07-09 19:09:14
【问题描述】:

对于我的 Symfony 应用程序,我使用 ANT 构建了一个部署脚本。在installation manual 中可以看到需要设置app/cache/ 和app/logs 目录的权限。因此,我在命令行上使用以下方法:

sudo chmod +a "_www allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs

setfacl 的方法不适用于我 (Mac OS),umask 的第三个选项不适合我。

所以我在考虑如何使用 ANT 来做到这一点并想出了这个:

<chmod perm="+a '_www allow delete,write,append,file_inherit,directory_inherit'">
    <fileset dir="app/cache" />
    <fileset dir="app/logs" />
</chmod>

问题是它什么都不做。我什至没有收到错误消息,也没有更改权限。对此有什么建议吗?我不能使用像perm="0775" 或perm="0777" 这样的解决方法,因为这样我就不能再用ANT 删除它了(只能用sudo ant,但这不是我想要的)。 有什么建议如何处理吗?

【问题讨论】:

    标签: symfony ant permissions acl


    【解决方案1】:

    好的,明白了:

    <exec executable="chmod" dir="webroot" failonerror="true">
        <arg line="+a '_www allow delete,write,append,file_inherit,directory_inherit' app/cache app/logs" />
    </exec>
    

    【讨论】:

      【解决方案2】:

      我的系统 (Debian Wheezy) 似乎不支持 +a 属性,但这对我有用(docs 中的第二个选项):

      <exec executable="/bin/sh" dir="${basedir}/app" failonerror="true">
          <arg value="-c"/>
          <arg value="setfacl -dR -m u:www-data:rwX -m u:`whoami`:rwX cache logs"/>
      </exec>
      

      使用sh -c 似乎是必要的,因为没有它我无法使用whoami 的反引号。

      您可能需要将dir="${basedir}/app" 更改为您自己的应用路径。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-01-07
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-03-21
        • 1970-01-01
        • 2019-07-19
        • 2013-09-09
        相关资源
        最近更新 更多