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

2023-06-29 22:28:54 +08:00
 opentrade

分别是提权和取消提权后的结果,并请告知发行版本和桌面环境,谢谢了,拜托

pkexec echo x; echo $?;
4981 次点击
所在节点    程序员
29 条回复
ljn917
2023-06-30 09:45:33 +08:00
```
$ pkexec echo x; echo $?;
x
0
```

Fedora 37, KDE, 会提示输入 root 密码
lesteryou
2023-06-30 10:00:52 +08:00
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
```
回车后,弹出密码验证框
dbskcnc
2023-06-30 10:25:29 +08:00
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
zsj1029
2023-06-30 10:26:55 +08:00
~ 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
kgcHQbTYyvcz2w3j
2023-06-30 10:33:42 +08:00
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
kokutou
2023-06-30 10:40:54 +08:00
msys2

➜ ~ pkexec echo x; echo $?;
zsh: command not found: pkexec
127
➜ ~
leehomyhh
2023-06-30 10:45:26 +08:00
[root@dev3430 ~]# pkexec echo x; echo $?;
x
0
Mikewangyankkk
2023-06-30 10:58:35 +08:00
[root@ypzflqgbrczsm2nr ~]# neofetch
##### root@ypzflqgbrczsm2nr.novalocal
####### -------------------------------
##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
xiaofami
2023-06-30 16:45:04 +08:00
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

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/952838

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX