【问题标题】:"pkexec /usr/bin/gdb" returns error "not authorized"\"pkexec /usr/bin/gdb\" 返回错误 \"not authorized\"
【发布时间】:2022-10-17 18:40:22
【问题描述】:

我想以 root 权限启动 gdb(我使用 Visual Studio Code 并希望以 root 身份启动 gdb,因为我要调试的应用程序需要 root)。在终端中,我输入:

pkexec /usr/bin/gdb

打开一个图形窗口,我在其中输入用户 (user15) 和 su 密码。

显示一条错误消息:

Error executing command as another user: Not authorized

为什么 pkexec 不让我以 root 身份启动 gdb?

/var/log/auth.log:

May 17 15:24:59 computer polkit-agent-helper-1[11775]: pam_unix(polkit-1:auth): conversation failed
May 17 15:24:59 computer polkit-agent-helper-1[11775]: pam_unix(polkit-1:auth): auth could not identify password for [user15]
May 17 15:24:59 computer polkitd(authority=local): Unregistered Authentication Agent for unix-session:8 (system bus name :1.140, object path /org/lxqt/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
May 17 15:24:59 computer polkitd(authority=local): Operator of unix-session:8 FAILED to authenticate to gain authorization for action org.freedesktop.policykit.exec for unix-process:9764:310891 [/bin/bash] (owned by unix-user:user15)
May 17 15:24:59 computer pkexec[11771]: user15: Error executing command as another user: Not authorized [USER=root] [TTY=/dev/pts/3] [CWD=/home/user15] [COMMAND=/usr/bin/gdb]
May 17 15:24:59 computer polkitd(authority=local): Registered Authentication Agent for unix-session:8 (system bus name :1.144 [/usr/bin/lxqt-policykit-agent], object path /org/lxqt/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)

用户在 sudo 组内:

computer:~$ groups
user15 adm cdrom sudo dip plugdev lpadmin sambashare

这是/etc/sudoers:

Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d

【问题讨论】:

  • 我不认为pkexec/etc/sudoers 有任何关系。尝试改用sudo(或设置适当的策略包策略)。

标签: linux gdb sudo


【解决方案1】:

您需要建立一个政策工具包 - 在这里查看:

https://bbs.archlinux.org/viewtopic.php?id=127716

【讨论】:

    猜你喜欢
    • 2014-12-14
    • 2021-10-30
    • 1970-01-01
    • 2018-07-19
    • 1970-01-01
    • 1970-01-01
    • 2014-11-29
    • 1970-01-01
    • 2018-06-23
    相关资源
    最近更新 更多