【问题标题】:When running php's msg_get_queue(), is there any way to specify the group ownership of the queue?运行 php 的 msg_get_queue() 时,有没有办法指定队列的组所有权?
【发布时间】:2021-05-28 05:09:41
【问题描述】:

msg_get_queue 的第二个参数是int $permissions = 0666,可以设置为0660 以限制当前组使用队列。

在调用此命令之前,有什么方法可以在不使用提升权限的情况下指定用户的哪个组是当前组?

在我的例子中,我希望队列对apache 组可用,以便用户apache 和该组的其他成员可以访问它。但是,这仅适用于用户 apache 是第一个调用该方法的用户,并且不能保证。

【问题讨论】:

    标签: php queue semaphore


    【解决方案1】:

    看起来它可以用sg 包装启动命令,例如,如果readqueue.php 脚本调用msg_get_queue() 可以运行:

    sg apache 'php readqueue.php'
    

    来自手册页:

    NAME
       sg - execute command as different group ID
    
    SYNOPSIS
       sg [-] [group [-c ] command]
    
    DESCRIPTION
       The sg command works similar to newgrp but accepts a command. The
       command will be executed with the /bin/sh shell...
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-04-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-10-03
      • 1970-01-01
      • 2013-06-12
      • 1970-01-01
      相关资源
      最近更新 更多