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



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?


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

Hello Christian,


On Friday, 03 May, 2013 11:53 PM, Christian Capasso wrote:

Thank you very much for your answer!

I have tried to use gksudo and it works without the Terminal window.
Anyway, I the problem is that gksudo, for some reason, does not accept any
parameter. For example, the "mkfs.vfat -n "Drive" -I /dev/sdf1" command
needs those arguments that can't be passed through gksudo.

Just pass an array as arguments with "gksudo" as the first element,
"mkfs.vfat" in the second, "-n" in the third, and so on.
If it didn't work try passing "gksudo" as the first element, then the
whole command as the second. I can't test it because I don't have gksudo in
my system. Try running "man gksudo" in the terminal to view it's manual or
"gksudo --help" to know how to use that gksudo.


 Is there a way to solve this issue and send arguments to gksudo? Or,
alternatively, is there a way to get and keep root permissions with gksudo,
just like "sudo -s" does?

Isn't gksudo used for graphical applications only? mkfs.vfat is a
command-line application, so you could just use "sudo -S" or su. On the
other hand, note that you shouldn't use sudo/su for graphical applications.

Note that gksudo is not available on all Linux distros. For example I use
openSUSE 12.3 and I don't have gksudo (it's not in the repositories either)
but I have gnomesu to run graphical applications as root. And there's also
gksu. And you couldn't ensure that su or sudo exists either (some distros
always run in root, like Puppy Linux), so you might need to check which one
exists on the system.


Regards,

Arnel



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