3

In Gnome, there is gksudo.

In KDE, there is kdesudo.

Is there a command that can be run on any desktop environment that will prompt the user for the root password and then run a command?

1

1 Answer 1

2

The manpage for the zenity command Manpage icon contains the following description:

zenity is a program that will display GTK+ dialogs, and return (either in the return code, or on standard output) the users input.

As far as I can tell (and my testing backs this up), this will work in both the Gnome and KDE desktop environments. For example:

zenity --password | sudo -S nautilus

...will prompt you for your root password and then launch Nautilus.

2
  • 1
    Wasn't there some reason you were supposed to run graphical programs using gksu/kdesudo rather than sudo though? Something about setting up the proper environment. Jan 10, 2013 at 6:34
  • Oh. I see you're discussing it in chat. Jan 10, 2013 at 6:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .