Page 1 of 1

using runprogram with sudo

Posted: Sun Aug 15, 2010 4:06 am
by sirrab
hi,

this has been asked before but the only one I can find it in the french forum.

how do I use runprogram with sudo.

I want to run apt-get but need to use sudo.

Thanks :D

Re: using runprogram with sudo

Posted: Sun Aug 15, 2010 11:55 pm
by freak
Did you try RunProgram("sudo", "<program> <parameters>", "") ?

Re: using runprogram with sudo

Posted: Wed Aug 18, 2010 3:34 am
by sirrab
hi freak,

yeh I tryed with sudo as command. I think the problem is you have to enter your password when using sudo.

Re: using runprogram with sudo

Posted: Wed Aug 18, 2010 12:55 pm
by remi_meier
How about 'gksudo' for Gnome and 'kdesudo' for KDE
instead of sudo?

Re: using runprogram with sudo

Posted: Wed Aug 18, 2010 2:08 pm
by Rescator
Heh, this is funny as it's the same "issue" that people started complaining about with Vista etc.

I guess on Linux you would either expect the user to sudo the program first.
Or inform them that a new version is available please do "sudo apt-get blahblah".
I have no idea if Linux actually have a Vista-like admin elevation prompt or not.

I mean you either run as a regular user or a admin on Linux, and you sudo only when you need to (like running a regular account on Vista+ and only using Run As Admin when needed, the automaticf elevation prompt and manifest support are just to make the transition easier for Windows users to the Linux system).

Can't you simply run apt-get in user mode and install stuff in the user folder rather than the system folder.
Only time you would need to use sudo was if you where not running as admin but needed to update systemwide libs or exes that all users use.

Edit: Ah it looks like gksudo or similar might be what you want.
http://www.google.com/images?hl=en&q=gk ... 20&bih=819
(looks like it's doing something similar to the Vista+ elevation prompt)

Edit2: Sorry I couldn't resist.
http://gordallott.wordpress.com/2008/05 ... -too-much/
(welcome to the new Windows club? *laughs*)

Re: using runprogram with sudo

Posted: Wed Aug 18, 2010 3:01 pm
by remi_meier
Rescator wrote:Heh, this is funny as it's the same "issue" that people started complaining about with Vista etc.

I guess on Linux you would either expect the user to sudo the program first.
Or inform them that a new version is available please do "sudo apt-get blahblah".
I have no idea if Linux actually have a Vista-like admin elevation prompt or not.
IMO there is one big difference. Linux programs were built with this
admin-user system in mind, meaning every program is installed system
wide as admin and stores user related info in the user's home folders.
When Vista first introduced this UAC thingy, the programs were just
not ready. A lot of them stored data in their installation folders or in
the registry where they shouldn't. Therefore there were just too many
UAC prompts. Not too many people are still complaining today..
And btw., UAC in Vista also prompts you even if you are already
privileged..

Actually in the Linux world, there is a "new" thing called PolicyKit which
is not integrated fully just yet. This system grants privileges for what
you want to do and not just elevates you to super-user. This also
means that one will have the possibility to grant a user certain privileges
by default (like installing applications).
Rescator wrote:Can't you simply run apt-get in user mode and install stuff in the user folder rather than the system folder.
Only time you would need to use sudo was if you where not running as admin but needed to update systemwide libs or exes that all users use.
Yeah, why not. I would not be against such a thing, but the current
way does not hinder me too much. I mean, how often do you install
new applications? But there are a few distributions that actually do
what you want.

greetz
remi

Re: using runprogram with sudo

Posted: Thu Aug 19, 2010 6:53 am
by sirrab
remi_meier wrote:How about 'gksudo' for Gnome and 'kdesudo' for KDE
instead of sudo?
thanks, I'll give it a go :D

Peronally I hate Vista, The dvd is sitting in a draw wasting away. I only run windows (XP) from virtual box to do my accounts. And that wont be forever as Im writing an accounts program in pb. :D

Re: using runprogram with sudo

Posted: Fri Aug 20, 2010 3:36 am
by GBeebe
http://www.purebasic.fr/english/viewtop ... 15&t=42912
Shows you how to use gksu to run a program as su.