php - 运行 php 的 msg_get_queue() 时,有没有办法指定队列的组所有权?
问题描述
msg_get_queue 的第二个参数是int $permissions = 0666
,可以设置为0660
将队列的使用限制为当前组。
有没有办法在调用此命令之前指定用户的哪个组是当前组,而不使用提升的权限?
就我而言,我希望队列可用于 group ,以便用户和该组的其他成员apache
可以访问它。apache
但是,这仅在用户apache
是第一个调用该方法的人时才有效,并且不能保证。
解决方案
看起来它可以用 包装启动命令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...
推荐阅读
- amazon-web-services - FFMPEG 转码的 AWS Lambda 执行时间
- python - 计数标记和类型 + 字典
- r - 过滤所有列中包含特定字符串的行(使用 dplyr)
- javascript - 在应用 Javascript 中更改经度和纬度时遇到问题
- c# - 从 Windows 资源管理器“打开方式”上下文菜单 C# Wpf 获取文件
- sas - SAS If-Else 多个条件
- vue.js - 如何使用 vuex 嵌套模块?
- racket - 在 Racket 中更有效地将列表写入文件
- vue.js - Vue路由器视图在尝试读取不在该组件中的变量时被破坏
- socket.io - 我可以使用仅在 Google Cloud Functions 或 Run 上运行 5 分钟的 socketio 部署迷你多人游戏服务器吗?