简体   繁体   English

shell_exec("journalctl"); 权限

[英]shell_exec("journalctl"); permissions

I'm trying to get log messages from journalctl from PHP, but getting an error - "Hint: You are currently not seeing messages from other users and the system. Users in the 'systemd-journal' group can see all messages."我正在尝试从 PHP 的 journalctl 获取日志消息,但出现错误 - “提示:您当前没有看到来自其他用户和系统的消息。'systemd-journal' 组中的用户可以看到所有消息。”

shell_exec('whoami') //shows "admin"

Tried to put into /etc/sudoers.d/admin these lines one by one but none of them worked试图将这些行一一放入 /etc/sudoers.d/admin 但它们都不起作用

%admin ALL=(root) NOPASSWD: /usr/sbin/journalctl
admin ALL=NOPASSWD: /usr/sbin/journalctl
%admin ALL=(ALL) ALL
www-data ALL=NOPASSWD: ALL

shell_exec("sudo -l"); shell_exec("sudo -l"); - doesn't indicate that this privilege has been granted - 不表示已授予此特权

How can I grant privilege to php shell_exec sudo on CENTOS 7 to get this request?如何在 CENTOS 7 上向 php shell_exec sudo 授予权限以获取此请求?

Add admin ALL=NOPASSWD: ALL to get this working.添加admin ALL=NOPASSWD: ALL以使其正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM