Re: [Vala] Process spawn not working when the Terminal is not opened



Thank you!

pkexec works perfectly!


2013/5/4 Christian Capasso <capasso912 gmail com>

Thank you!

pkexec works perfectly!


2013/5/4 Arnel A. Borja <kyoushuu yahoo com>

Hello,


On Fri, 2013-05-03 at 19:48 +0200, Christian Capasso wrote:

If I need root's permissions, for example when it comes to the format,
or to the umount, what should I do? Should I use Process.spawn or not?


If you need root permissions, you could:

- Use Process.spawn_async_with_pipes if you want to use sudo or su.
These programs ask for the password from the standard input so you need
to check the pipes for "Password" or "password". Then show your own
dialog for asking password.

- Use Process.spawn_async if you want to use gksudo, gksu, gnomesu or
pkexec as recommended by Shawn Ferris. I think the best would be pkexec,
since it uses a dialog that matches the desktop environment and
available on most distros (Ubuntu, Fedora and openSUSE has it). The
other ones have their own password dialog.

- Create a DBus service then use polkit. This is a good choice (the
administrator could control what actions the users could execute, ...)
but harder than the ones above. This is how official GNOME applications
do formatting/mounting and other actions. It is also possible to use an
existing service, gnome-disks has actions for mounting, unmounting and
formatting partitions.


Regards,

Arnel





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]