using runprogram with sudo

Linux specific forum
User avatar
sirrab
Enthusiast
Enthusiast
Posts: 106
Joined: Thu Dec 07, 2006 8:52 am
Location: New Zealand

using runprogram with sudo

Post 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
freak
PureBasic Team
PureBasic Team
Posts: 5948
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: using runprogram with sudo

Post by freak »

Did you try RunProgram("sudo", "<program> <parameters>", "") ?
quidquid Latine dictum sit altum videtur
User avatar
sirrab
Enthusiast
Enthusiast
Posts: 106
Joined: Thu Dec 07, 2006 8:52 am
Location: New Zealand

Re: using runprogram with sudo

Post 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.
remi_meier
Enthusiast
Enthusiast
Posts: 468
Joined: Sat Dec 20, 2003 6:19 pm
Location: Switzerland

Re: using runprogram with sudo

Post by remi_meier »

How about 'gksudo' for Gnome and 'kdesudo' for KDE
instead of sudo?
Athlon64 3700+, 1024MB Ram, Radeon X1600
User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

Re: using runprogram with sudo

Post 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*)
remi_meier
Enthusiast
Enthusiast
Posts: 468
Joined: Sat Dec 20, 2003 6:19 pm
Location: Switzerland

Re: using runprogram with sudo

Post 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
Athlon64 3700+, 1024MB Ram, Radeon X1600
User avatar
sirrab
Enthusiast
Enthusiast
Posts: 106
Joined: Thu Dec 07, 2006 8:52 am
Location: New Zealand

Re: using runprogram with sudo

Post 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
GBeebe
Enthusiast
Enthusiast
Posts: 263
Joined: Sat Oct 09, 2004 6:52 pm
Location: Franklin, PA - USA
Contact:

Re: using runprogram with sudo

Post by GBeebe »

http://www.purebasic.fr/english/viewtop ... 15&t=42912
Shows you how to use gksu to run a program as su.
Post Reply