分别是提权和取消提权后的结果,并请告知发行版本和桌面环境,谢谢了,拜托
pkexec echo x; echo $?;
分别是提权和取消提权后的结果,并请告知发行版本和桌面环境,谢谢了,拜托
pkexec echo x; echo $?;
|
churchmiceJun 29, 2023
1
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. |
|
2
ubuntu22.04
需要输入密码运行这个命令,运行后得到输出 x 0 |
|
3
Ubuntu 22.04.2 LTS on Windows 10 x86_64
****@LAPTOP-Fan:~$ sudo pkexec echo x; echo $?; [sudo] password for ****: x 0 |
|
4
我遇到了跟这个问题完全一致的现象:
https://askubuntu.com/questions/799669/etc-sudoers-file-corrupted-and-i-cant-run-pkexec-visudo-over-ssh 在单会话 SSH 中 auth 失败。 但 systemctl 这样的提权命令又是能成功通过验证的 sudo pkexec 正常 |
|
5
Error executing command as another user: Request dismissed
126 Ubuntu 23.04 |
|
6
➜ ~ uname -a
Linux vultr 5.15.0-58-generic #64-Ubuntu SMP Thu Jan 5 11:43:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux ➜ ~ cat /etc/issue Ubuntu 22.04.2 LTS \n \l ➜ ~ pkexec echo x; echo $?; x 0 ➜ ~ |
|
7
|
|
8
admin 账户 sudo 前缀
x 0 Linux itis-bli-20476 5.19.0-43-generic #44~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon May 22 13:39:36 UTC 2 x86_64 x86_64 x86_64 GNU/Linux |
|
9
```bash
$ pkexec echo x; echo $?; ==== AUTHENTICATING FOR org.freedesktop.policykit.exec ==== Authentication is needed to run `/usr/bin/echo' as the super user Authenticating as: vrqq Password: polkit-agent-helper-1: error response to PolicyKit daemon: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: No session for cookie ==== AUTHENTICATION FAILED ==== Error executing command as another user: Not authorized This incident has been reported. 127 $ sudo pkexec echo x; echo $?; x 0 $ gnome-shell --version GNOME Shell 40.10 ``` Red Hat Enterprise Linux release 9.2 (Plow) Linux rhedt 5.14.0-284.18.1.el9_2.x86_64 |
|
10
❯ pkexec echo x; echo $?;
Error executing command as another user: Request dismissed 126 ❯ pkexec echo x; echo $?; x 0 ❯ cat /etc/redhat-release Fedora release 38 (Thirty Eight) |
|
basncyJun 30, 2023
11
支持楼主开发桌面 app.
可以 ps -ef 检查有没有 polkit 进程来接收请求, 没有就返回 127, 有就是 0. 不同桌面环境进程名不一样, xfce 和 i3 桌面环境是 /usr/lib/xfce-polkit/xfce-polkit https://wiki.archlinux.org/title/Polkit |
|
0superx0Jun 30, 2023
12
lin@x:~$ pkexec echo x; echo $?;
x 0 lin@x:~$ neofetch ##### lin@x ####### ----- ##O#O## OS:ubuntu 18.04 x86_64 ####### Host: 2325GB6 ThinkPad X230 ########### Kernel: 6.1.0-20230601 ############# Uptime: 1 day, 5 hours, 16 mins ############### Packages: 2175 ################ Shell: bash 4.4.20 ################# Resolution: 1920x1080 ##################### DE: Unity:Unity7:ubuntu ##################### WM: Compiz ################# WM Theme: Adwaita Theme: Ambiance [GTK2/3] Icons: Ubuntu-mono-dark [GTK2/3] Terminal: gnome-terminal CPU: Intel i7-3615QE (8) @ 3.300GHz GPU: Intel HD Graphics 4000 Memory: 2472MiB / 15576MiB |
|
xshellJun 30, 2023
13
root@debian12:~# pkexec echo x; echo $?;
x 0 |
|
sunnysabJun 30, 2023
14
[sunnysab@archlinux ~]$ pkexec echo x; echo $?;
x 0 执行前弹出了密码输入框。 |
|
wozhidaoleJun 30, 2023
15
[root@VM-4-10-centos ~]# pkexec echo x; echo $?;
x 0 [root@VM-4-10-centos ~]# uname -a Linux VM-4-10-centos 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux [root@VM-4-10-centos ~]# |
|
luozicJun 30, 2023
16
ubuntu23.04
Ubuntu@ubuntu:~$ pkexec echo x; echo $?; x 0 |
|
userffJun 30, 2023
17
Deepin 20.9
```bash # f @ f-PC in ~ [9:29:17] $ pkexec echo x; echo $?; x 0 ``` |
|
eceeJun 30, 2023
18
archlinux, 桌面是 vnc 启动的 xfce ,需要输入 root 密码
[test@legion ~]$ pkexec echo x; echo$?; x 0 |
|
DOOMSJun 30, 2023
19
ubun-virtual-machine ~ » pkexec echo x; echo $?;
x 0 但是需要输入密码 环境: yyyyy- -yyyyyy+ OS: Ubuntu 18.04 bionic ://+//////-yyyyyyo Kernel: x86_64 Linux 5.4.0-150-generic |
|
sxzzsfJun 30, 2023
20
bash: pkexec: command not found
127 |
|
ljn917Jun 30, 2023 via Android
21
```
$ pkexec echo x; echo $?; x 0 ``` Fedora 37, KDE, 会提示输入 root 密码 |
|
lesteryouJun 30, 2023
22
Deepin 20.9
Linux Ori-DP 5.17.3-amd64-desktop #1 SMP PREEMPT Fri Apr 29 15:22:29 CST 2022 x86_64 GNU/Linux ``` ~ ⌚ 9:57:42 $ pkexec echo x; echo $? x 0 ``` 回车后,弹出密码验证框 |
|
dbskcncJun 30, 2023
23
manjaro kde
pkexec echo x; echo $? x 0 pkexec echo x; echo $? Error executing command as another user: Not authorized This incident has been reported. 127 |
|
zsj1029Jun 30, 2023
24
~ sudo pkexec echo x; echo $?;
x 0 ~ lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux trixie/sid Release: n/a Codename: trixie Debian 12 |
|
kgcHQbTYyvcz2w3jJun 30, 2023
25
Arch Linux 6.3.8-arch1-1 直接 x11 套 awesome wm , 加不加 sudo 有两种结果
$ pkexec echo x; echo $?; x 0 $ sudo pkexec echo x; echo $?; ==== AUTHENTICATING FOR org.freedesktop.policykit.exec ==== Authentication is needed to run `/usr/bin/echo' as the super user Authenticating as: Max (max) Password: polkit-agent-helper-1: error response to PolicyKit daemon: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: No session for cookie ==== AUTHENTICATION FAILED ==== Error executing command as another user: Not authorized This incident has been reported. 127 |
|
kokutouJun 30, 2023
26
msys2
➜ ~ pkexec echo x; echo $?; zsh: command not found: pkexec 127 ➜ ~ |
|
leehomyhhJun 30, 2023
27
[root@dev3430 ~]# pkexec echo x; echo $?;
x 0 |
|
MikewangyankkkJun 30, 2023
28
[root@ypzflqgbrczsm2nr ~]# neofetch
##### [email protected] ####### ------------------------------- ##O#O## OS: Anolis OS 8.8 x86_64 ####### Host: OpenStack Compute 17.0.3-1.el7 ########### Kernel: 5.10.134-14.1.an8.x86_64 ############# Uptime: 22 days, 21 hours, 1 min ############### Packages: 823 (rpm) ################ Shell: bash 4.4.20 ################# Resolution: 1024x768 ##################### Terminal: /dev/pts/0 ##################### CPU: Intel Xeon (Skylake, IBRS) (2) @ 2.299GHz ################# GPU: 00:02.0 Cirrus Logic GD 5446 Memory: 846MiB / 3725MiB [root@ypzflqgbrczsm2nr ~]# pkexec echo x; echo $?; x 0 |
|
xiaofamiJun 30, 2023
29
Manjaro ARM:
[marly@manjaro ~]$ sudo inxi -F System: Host: manjaro Kernel: 6.3.0-1-MANJARO-ARM-ODROID arch: aarch64 bits: 64 Console: pty pts/1 Distro: Manjaro ARM Machine: Type: ARM System: Amlogic Meson GXBB P201 Development Board details: N/A CPU: Info: quad core model: N/A variant: cortex-a53 bits: 64 type: MCP Speed (MHz): avg: 2016 min/max: 100/2016 cores: 1: 2016 2: 2016 3: 2016 4: 2016 Graphics: Device-1: meson-gxbb-dw-hdmi driver: meson_dw_hdmi v: N/A Device-2: meson-gxbb-vpu driver: meson_drm v: N/A Device-3: meson-gxbb-mali driver: lima v: kernel Display: server: Xwayland v: 23.1.1 driver: N/A tty: 179x49 API: EGL/GBM Message: No known Wayland EGL/GBM data sources. Audio: Device-1: meson-gxbb-dw-hdmi driver: meson_dw_hdmi API: ALSA v: k6.3.0-1-MANJARO-ARM-ODROID status: kernel-api Network: Device-1: meson-gxbb-dwmac driver: meson8b_dwmac IF: eth0 state: up speed: 100 Mbps duplex: full mac: 2e:a9:49:75:91:71 Device-2: pwm-clock driver: pwm_clock IF-ID-1: ip6tnl0 state: down mac: 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 Drives: Local Storage: total: 123.02 GiB used: 14.85 GiB (12.1%) ID-1: /dev/mmcblk0 model: ED2S5 size: 119.38 GiB ID-2: /dev/mmcblk1 model: 4FPD3R size: 3.64 GiB Partition: ID-1: / size: 116.99 GiB used: 14.79 GiB (12.6%) fs: ext4 dev: /dev/mmcblk0p2 ID-2: /boot size: 457.5 MiB used: 53.8 MiB (11.8%) fs: vfat dev: /dev/mmcblk0p1 Swap: Alert: No swap data was found. Sensors: Src: lm-sensors+/sys Message: No sensor data found using /sys/class/hwmon or lm-sensors. Info: Processes: 158 Uptime: 18d 8h 21m Memory: available: 922.9 MiB used: 474.8 MiB (51.4%) Init: systemd Shell: Bash inxi: 3.3.27 [marly@manjaro ~]$ pkexec echo x; echo $?; ==== AUTHENTICATING FOR org.freedesktop.policykit.exec ==== Authentication is needed to run `/usr/bin/echo' as the super user Authenticating as: marly Password: polkit-agent-helper-1: error response to PolicyKit daemon: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: No session for cookie ==== AUTHENTICATION FAILED ==== Error executing command as another user: Not authorized This incident has been reported. 127 [marly@manjaro ~]$ sudo pkexec echo x; echo $?; x 0 |