linux - 运行一个应用程序时启动授权对话框

标签 linux gnome

在我的应用程序中,我需要将一些文件写入 Linux 文件系统文件夹,这需要

super 用户访问权限。

那么,我如何调用该对话框,以便当前用户拥有 super 用户权限,直到

写操作完成。我正在使用 glib 相关的 API。

问候, 列宁

最佳答案

您需要使用 GKSu或更新的 PolicyKit .

GKSu is a library that provides a Gtk+ frontend to su and sudo. It supports login shells and preserving environment when acting as a su frontend. It is useful to menu items or other graphical programs that need to ask a user's password to run another program as another user.

关于linux - 运行一个应用程序时启动授权对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6777637/

相关文章:

objective-c - 适用于 mac os 10.6 雪豹的 glib

gtk - Gnome 3.10 与 3.14 中的扩展事件循环

Linux命令显示你的机器拥有的硬盘插槽数量

linux - 以编程方式检测处理器类型 (Linux)

security - 受密码保护的 ssh key - 只被要求输入一次密码

gnome - 我如何从头开始构建vala

使用 Javascript 和 gjs 进行 Unicode 文件 I/O?

python - 创建包含 python 程序的 rpm

linux - 使用 Splunk 模拟安全漏洞

linux - 数字键盘。点而不是逗号