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

发布于 2024-11-25 08:34:10 字数 146 浏览 1 评论 0原文

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

超级用户访问权限。

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

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

问候, 列宁

In my application i need to write some files into Linux file system folder, which requires

super user access permission.

So, how can i invoke that dialog so that current user will have super user permission until

write operation finishes. I am using glib related APIs.

Regards,
Lenin

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

想你的星星会说话 2024-12-02 08:34:10

您需要使用 GKSu 或较新的 PolicyKit

GKSu 是一个为 su 和 sudo 提供 Gtk+ 前端的库。作为 su 前端时,它支持登录 shell 和保存环境。对于需要询问用户密码才能以另一个用户身份运行另一个程序的菜单项或其他图形程序非常有用。

You need to use GKSu or the newer 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文