Ubuntu 18.04:未找到 polkit 身份验证代理

Ubuntu 18.04:未找到 polkit 身份验证代理

当我尝试在 Visual Studio Code 中写入我没有权限的文件时,我收到上述错误消息。我选择“以 sudo 身份重试”: 单击 sudo 并得到错误: 错误信息

仅当我使用 ssh 和 X11 转发从 PC 连接到机器时才会发生这种情况。当我在 Ubuntu 机器上直接通过 gnome 运行时不会发生这种情况。

非常感谢您的帮助。

Output from "systemctl status polkit.service"  

Sep 02 20:03:19 rolf-PE-860 systemd[1]: Starting Authorization Manager...
Sep 02 20:03:19 rolf-PE-860 systemd[1]: Started Authorization Manager.
Sep 02 20:03:19 rolf-PE-860 polkitd[4155]: started daemon version 0.105 using authority implementation `local' version `0.105'
Sep 02 20:03:19 rolf-PE-860 polkitd(authority=local)[4155]: Registered Authentication Agent for unix-session:14 (system bus name :1.80 [/usr/bin/gnome-shell], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
Sep 02 20:03:19 rolf-PE-860 polkitd(authority=local)[4155]: Registered Authentication Agent for unix-session:c2 (system bus name :1.40 [/usr/bin/gnome-shell], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
Sep 02 20:03:45 rolf-PE-860 polkitd(authority=local)[4155]: Registered Authentication Agent for unix-process:4160:201286 (system bus name :1.124 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
Sep 02 20:03:51 rolf-PE-860 polkitd(authority=local)[4155]: Operator of unix-process:4160:201286 successfully authenticated as unix-user:rolf to gain ONE-SHOT authorization for action org.freedesktop.systemd1.manage-units for system-bus-name::1.125 [systemctl start polkit.service] (owned by unix-user:rolf)
Sep 02 20:03:51 rolf-PE-860 polkitd(authority=local)[4155]: Unregistered Authentication Agent for unix-process:4160:201286 (system bus name :1.124, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)

答案1

我最近也遇到了同样的问题。我是新手,所以我不知道这是否可以解决你的问题,但这是我的解决方案。

  1. 找出我正在使用的桌面环境

    ps -A | egrep -i "gnome|kde|mate|cinnamon|lx|xfce|jwm"
    
  2. 搜索相应policykit包并安装。

    sudo apt search policykit
    sudo apt install policykit-1-gnome
    

    我的桌面环境是 GNOME

  3. (不知道这一步是否有必要)

    exec /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1
    

然后我的问题就解决了。

相关内容