当我们使用X2Go客户端登录到KDE时,用户会看到一个询问sudo密码的对话框。我不希望用户有一个sudo密码,我想阻止对话框的出现。用户不应该对此感到困扰。
对话框标题是:Authentication Required PolicyKit1 KDE Agent
其信息是:
**System policy prevents control of network connections**
An application is attempting to perform an action that requires privileges. Authentication is required to perform this action.
Password:
Action: Allow control of network connections
ID: org.freedesktop.NetworkManager.network-control
Vendor: NetworkManager
polkit.subject-pid: 20440
polkit.caller-pid: 708
- process 708 is /usr/bin/NetworkManager --no-daemon
- process 20440 is kded5 [kdeinit5]
pkaction version 0.116 (that's the policykit version)
已定义了相关策略,因此不应请求/要求身份验证:
<action id="org.freedesktop.NetworkManager.network-control">
<_description>Allow control of network connections</_description>
<_message>System policy prevents control of network connections</_message>
<defaults>
<allow_inactive>yes</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
</action>
相关的日志线是:
Aug 07 21:50:54 desktop polkit-kde-authentication-agent-1[26611]: "Password: "
Aug 07 21:50:54 desktop polkit-kde-authentication-agent-1[26611]: Request: "Password: "
Aug 07 21:50:54 desktop polkit-kde-authentication-agent-1[26611]: REQUEST
Aug 07 21:50:54 desktop polkit-kde-authentication-agent-1[26611]: Trying again
Aug 07 21:50:54 desktop polkit-kde-authentication-agent-1[26611]: Action description has been found
Aug 07 21:50:54 desktop polkit-kde-authentication-agent-1[26611]: Message of action: "System policy prevents control of network connections"
Aug 07 21:50:54 desktop polkit-kde-authentication-agent-1[26611]: Initiating authentication
Aug 07 21:50:54 desktop polkit-kde-authentication-agent-1[26611]: polkit_qt_listener_initiate_authentication callback for 0x55df1e7190a0
Aug 07 21:50:54 desktop polkit-kde-authentication-agent-1[26611]: GSimpleAsyncResult:
Aug 07 21:50:54 desktop polkit-kde-authentication-agent-1[26611]: Listener adapter polkit_qt_listener_initiate_authentication
Aug 07 21:50:43 desktop polkit-kde-authentication-agent-1[26611]: Authentication agent result: true
Aug 07 21:50:43 desktop polkitd[838]: Registered Authentication Agent for unix-session:19 (system bus name :1.5274 [/usr/lib/polkit-kde-authentication-agent-1], object path /org/kde/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
Aug 07 21:50:43 desktop polkit-kde-authentication-agent-1[26611]: Listener online
Aug 07 21:50:43 desktop polkit-kde-authentication-agent-1[26611]: Adding new listener PolkitQt1::Agent::Listener
Aug 07 21:50:43 desktop polkit-kde-authentication-agent-1[26611]: New PolkitAgentListener
Aug 07 21:50:42 desktop ksmserver[26587]: org.kde.kf5.ksmserver: Starting autostart service "/etc/xdg/autostart/polkit-kde-authentication-agent-1.desktop" ("/usr/lib/polkit-kde-authentication-agent-1")
到目前为止,我尝试的是创建这个polkit规则:
/etc/polkit-1/rules.d/00-networkmanager.rules
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.NetworkManager.settings.modify.system")
{
polkit.log("NetworkManager.settings.modify.system: rule called");
return polkit.Result.YES;
}
});
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.NetworkManager.network-control")
{
polkit.log("NetworkManager.network-control: rule called");
return polkit.Result.YES;
}
});
该规则由root拥有,并具有644个权限。
发布于 2022-06-29 05:08:55
尝试如下:在/etc/polkit-1/localauthority/50-local.d文件夹中创建一个名为universal.pkla的文件,其中包含以下内容:
[Allow access to anything for remote users]
Identity=unix-user:*
Action=*
ResultAny=yes
ResultInactive=yes
ResultActive=yes
然后用“systemctl重新启动polkit.service”重新启动polkit或重新启动。从那以后,我就没有见过任何polkit身份验证提示。
https://unix.stackexchange.com/questions/534469
复制相似问题