Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wanted to make a program (with quickly) that edits some root files.

My question: How can i ask for root permission (after a button is clicked) to execute a command (just like the software center does)?
I want it to be universal. For both gnome and kde

share|improve this question

Such a popup would come up if you execute


system("gksudo <command>");


system("kdesudo <command>");
share|improve this answer
gksudo update-alternatives --remove-all java throws me an error. btw, i need something that also works with kde – mid_kid Oct 21 '12 at 18:34
This is valuable information and should be added to your original question. – cauon Oct 21 '12 at 18:52
here you go @cauon ;) It's up to mid_kid to create a variable for the gksudo/kdesudo difference. – Rinzwind Oct 22 '12 at 10:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.