構成変更を実行するために最初に実行するときに、一時的にルートを必要とするプログラムを作成しています (ファイルを に作成します/etc
)。
グラフィカル ダイアログ ボックスでユーザーにパスワードを要求して、一時的に root を取得するにはどうすればよいですか?
gksudo
プログラムはQtを使用しており、Ubuntuでのみ動作する場合はかなり満足していますが、それらがインストールされているか、インストールされているとは思いたくありません。私も使えませんSUID
。
私が考えることができる唯一のことは、独自のパスワードダイアログを提供し、それを(または安全性の低いいとこの1つをsudo
介して)コマンドラインバイナリに供給することです。system()
しかし、それはかなりハックに思えます - コマンドラインのフロントエンドは一般的にひどいアイデアであり、絶対に避けるべきです. それで、より良い方法はありますか?おそらくlibsudo、またはIPCを使用する方法がありますか?
注意:これは複製ではありません。または、少なくとも、そこにある回答は、私が求めている質問としてそれを扱っていません。