Ubuntu 22.04 Gnome GUI 不要求输入密码来执行特权操作(例如软件更新程序)-您无权执行此操作

Ubuntu 22.04 Gnome GUI 不要求输入密码来执行特权操作(例如软件更新程序)-您无权执行此操作

截屏

我刚刚安装了 Ubuntu 22.04 Server。之后我安装了 Slim 和 ubuntu-desktop 来获得 GUI。

当我登录 GUI 并打开软件更新程序时,它告诉我“您无权执行此操作”,并且不要求我输入密码。所以我不能用它来安装更新。不久前我在 Linux Mint 上遇到了类似的问题,我安装了 xdrp,并根据一些指南输入了一些解决方法来使其工作。这导致 PolicyKit 无法正常工作。我也再次使用 xdrp,但这次我没有犯同样的错误。

我在这里只发现了一些针对旧版本的旧主题,但据我所知,它们都没有真正的解决方案。

有什么方法可以查明问题的真正原因并加以解决?

有人在另一个线程中要求提供一些输出,这可能也会有帮助。 身份验证错误:无法安装或删除软件 | 您无权执行此操作

ubuntu@digioso:~$ groups
ubuntu adm dialout cdrom floppy sudo audio dip video plugdev netdev lxd admin
ubuntu@digioso:~$ sudo echo success
success
ubuntu@digioso:~$ pkexec echo success
==== AUTHENTICATING FOR org.freedesktop.policykit.exec ===
Authentication is needed to run `/usr/bin/echo' as the super user
Multiple identities can be used for authentication:
 1.  Ubuntu (ubuntu)
 2.  Ubuntu (ubuntu)
Choose identity to authenticate as (1-2): 1
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.
ubuntu@digioso:~$ pkexec echo success
==== AUTHENTICATING FOR org.freedesktop.policykit.exec ===
Authentication is needed to run `/usr/bin/echo' as the super user
Multiple identities can be used for authentication:
 1.  Ubuntu (ubuntu)
 2.  Ubuntu (ubuntu)
Choose identity to authenticate as (1-2): 2
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.
ubuntu@digioso:~$

ubuntu@digioso:~$ systemctl status polkit.service
● polkit.service - Authorization Manager
     Loaded: loaded (/lib/systemd/system/polkit.service; static)
     Active: active (running) since Wed 2023-01-04 20:28:28 CET; 1 day 13h ago
       Docs: man:polkit(8)
   Main PID: 936
      Tasks: 3 (limit: 28694)
     Memory: 5.3M
        CPU: 911ms
     CGroup: /system.slice/polkit.service
             └─936 /usr/libexec/polkitd --no-debug

Jan 05 21:08:26 digioso.subnet12221621.vcn12221621.oraclevcn.com polkitd(authority=local)[936]: Unregistered Authentication Agent for unix-process:306901:8860360 (system bus name>
Jan 05 21:08:35 digioso.subnet12221621.vcn12221621.oraclevcn.com polkitd(authority=local)[936]: Registered Authentication Agent for unix-process:306901:8860360 (system bus name :>
Jan 05 21:08:44 digioso.subnet12221621.vcn12221621.oraclevcn.com polkitd(authority=local)[936]: Operator of unix-process:306901:8860360 FAILED to authenticate to gain authorizati>
Jan 05 21:08:44 digioso.subnet12221621.vcn12221621.oraclevcn.com polkitd(authority=local)[936]: Unregistered Authentication Agent for unix-process:306901:8860360 (system bus name>
Jan 05 21:10:48 digioso.subnet12221621.vcn12221621.oraclevcn.com polkitd(authority=local)[936]: Registered Authentication Agent for unix-process:306901:8860360 (system bus name :>
Jan 05 21:10:53 digioso.subnet12221621.vcn12221621.oraclevcn.com polkitd(authority=local)[936]: Operator of unix-process:306901:8860360 FAILED to authenticate to gain authorizati>
Jan 05 21:10:53 digioso.subnet12221621.vcn12221621.oraclevcn.com polkitd(authority=local)[936]: Unregistered Authentication Agent for unix-process:306901:8860360 (system bus name>
Jan 05 21:10:54 digioso.subnet12221621.vcn12221621.oraclevcn.com polkitd(authority=local)[936]: Registered Authentication Agent for unix-process:306901:8860360 (system bus name :>
Jan 05 21:10:59 digioso.subnet12221621.vcn12221621.oraclevcn.com polkitd(authority=local)[936]: Operator of unix-process:306901:8860360 FAILED to authenticate to gain authorizati>
Jan 05 21:10:59 digioso.subnet12221621.vcn12221621.oraclevcn.com polkitd(authority=local)[936]: Unregistered Authentication Agent for unix-process:306901:8860360 (system bus name>
ubuntu@digioso:~$ 

谢谢@lucius,但我发现我遇到了不同的问题。

root@digioso:/etc/polkit-1/localauthority.conf.d# ls -lart
total 16
-rw-r--r-- 1 root root   65 Feb 26  2022 51-ubuntu-admin.conf
-rw-r--r-- 1 root root  267 Feb 26  2022 50-localauthority.conf
drwxr-xr-x 4 root root 4096 Nov  6 03:31 ..
drwxr-xr-x 2 root root 4096 Nov  6 03:32 .
root@digioso:/etc/polkit-1/localauthority.conf.d# cat ^C
root@digioso:/etc/polkit-1/localauthority.conf.d# cat 51-ubuntu-admin.conf
[Configuration]
AdminIdentities=unix-group:sudo;unix-group:admin
root@digioso:/etc/polkit-1/localauthority.conf.d# cat 50-localauthority.conf
# Configuration file for the PolicyKit Local Authority.
#
# DO NOT EDIT THIS FILE, it will be overwritten on update.
#
# See the pklocalauthority(8) man page for more information
# about configuring the Local Authority.
#

[Configuration]
AdminIdentities=unix-user:0
root@digioso:/etc/polkit-1/localauthority.conf.d#

答案1

我遇到了这个问题,并弄清楚了原因。但请记住,这可能是一个非常特殊的情况。我专门为我儿子的帐户关闭了这些身份验证弹出窗口,因为 STEAM 有一个烦人的问题:它要求输入管理员用户密码来修改全局网络设置,这是绝对不可接受的。

90-silence-steam.conf我在目录中创建了一个文件/etc/polkit-1/localauthority.conf.d/,其内容如下:

[Stop steam user from prompting for network permissions]
Identity unix-user:username
Action org.freedesktop.NetworkManager.settings.modify.system
ResultActive no
ResultInactive no
ResultAny no

如果您在目录中的某些配置中执行了类似操作/etc/polkit-1/localauthority.conf.d/,那么这可能是原因。因此,您可以撤消所做的任何操作并找到其他解决方法。目前,我只是用禁用了那里的每一行#

我希望它至少能够帮助那些与我出于同样原因遇到此问题的人。

相关内容