帮我执行个 Linux 命令,看看兼容性

查看 73|回复 4
作者:opentrade   
分别是提权和取消提权后的结果,并请告知发行版本和桌面环境,谢谢了,拜托
pkexec echo x; echo $?;

echo, pkexec, Linux, 拜托

churchmice   
RETURN VALUE
Upon successful completion, the return value is the return value of PROGRAM. If the
calling process is not authorized or an authorization could not be obtained through
authentication or an error occured, pkexec exits with a return value of 127. If the
authorization could not be obtained because the user dismissed the authentication
dialog, pkexec exits with a return value of 126.
Donahue   
ubuntu22.04
需要输入密码运行这个命令,运行后得到输出
x
0
coolfan   
Ubuntu 22.04.2 LTS on Windows 10 x86_64
****@LAPTOP-Fan:~$ sudo pkexec echo x; echo $?;
[sudo] password for ****:
x
0
GeruzoniAnsasu   
我遇到了跟这个问题完全一致的现象:
https://askubuntu.com/questions/799669/etc-sudoers-file-corrupted-and-i-cant-run-pkexec-visudo-over-ssh
在单会话 SSH 中 auth 失败。
但 systemctl 这样的提权命令又是能成功通过验证的
sudo pkexec 正常
您需要登录后才可以回帖 登录 | 立即注册

返回顶部