[opensuse] Re: Running a program as root from desktop panel



(Please don't top post. Reformatting it)

Jake Conk wrote:
On 10/11/07, Jonathan Ervine <jervine@xxxxxxxxxx> wrote:
On Friday 12 October 2007 00:57:31 Jake Conk wrote:
No you misunderstood, good try though.
Grrr... top-posting. You're breaking the logic of the thread. I'd say Roger
understood perfectly what you're trying to achieve. He's given you a solution
based on KDE, but it's a trivial adaptation for GNOME (which you've already
mentioned you've got).

sudo is going to be a waste of time, as it will be expecting a terminal
console in which to enter the password to allow privileged access. However,
if you look at Roger's script he's checking to see if the current user is id
0 (this is root by the way). If it is, then the application is launched. If
not, then it launches the application via kdesu. kdesu, in case you didn't
know, is a 'wrapper' binary that prompts for the root password to launch a
privileged application. It's how YaST2 is launched in the KDE desktop
environment.

Now as you mentioned you've got GNOME available you might want to look again
at Roger's script, and google for gnomesu

Jon

On 10/11/07, Roger Oberholtzer <roger@xxxxxx> wrote:
On Thu, 2007-10-11 at 03:57 -0700, Jake Conk wrote:
Hello,

i want to add a program to my desktop panel but it needs to be ran as
root when clicked... How do make a it prompt for my root password when
I click on that application from a panel? I tried putting sudo in
front of it in hopes a prompt of some sort will come up but no luck.

Regards,
- Jake

PS. If it matters, I'm running Xfce but I have Gnome installed if I
need something from gnome.
Or KDE? This may run outside KDE. I use something like this:


LAUNCH_CMD="MyCommand"

if test `id -u` -eq 0 ; then
exec $LAUNCH_CMD 2> /dev/null
else
kdesu -n -c "$LAUNCH_CMD" 2> /dev/null
fi


I send errors to /dev/null for the heck of it. Remove as needed.

--
This is obviously to launch a program from my panel as I mentioned and
I'm obviously not root so there is no need to make a script which is
going a bit beyond of what I wanted to do. I guess if I had kde
installed the kdesu <program> would have worked but since I don't then
a better answer would have been gnomesu.

Anyways I've found gksu which is actually the right answer because it
doesn't require gnome or kde and it solves my problem. No need to make
it into a script or anything..

Actually, the script is a good idea. It is checking to see if you are already
root, so it doesn't ask you again for the root password. This makes it a generally
useful script that you can use anywhere. And yes, simply replacing
'kdesu' with 'gksu' (or gnomesu) is what you want to do.

--
Jonathan Arnold (mailto:jdarnold@xxxxxxxxxxxx)
Linux Brain Dump - Linux Notes, HOWTOs and Tutorials:
http://www.linuxbraindump.org

Daemon Dancing in the Dark, an Open OS weblog:
http://freebsd.amazingdev.com/blog/

--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx



Relevant Pages

  • Re: Greetings / Newbie questions
    ... Please, don't jump on the "Linux is the be-all, end-all OS and is ... I am having a bit of trouble deciding which to use: Gnome or KDE. ... >I have found that alot of things need to be done as root. ...
    (alt.os.linux.redhat)
  • Re: How dial outside of KDE/Gnome ???
    ... ]>>> I can dial my ISP nicely from KDE or Gnome. ... Worked fine in command line driven mode (even script ...
    (comp.os.linux.networking)
  • Re: Greetings / Newbie questions
    ... I did a full install so don't think I am missing nay packages. ... I am having a bit of trouble deciding which to use: Gnome or KDE. ... > I have found that alot of things need to be done as root. ...
    (alt.os.linux.redhat)
  • Re: [opensuse] Re: Running a program as root from desktop panel
    ... if you look at Roger's script he's checking to see if the current user is id ... (this is root by the way). ... then it launches the application via kdesu. ... Now as you mentioned you've got GNOME available you might want to look again ...
    (SuSE)
  • Re: [opensuse] Running a program as root from desktop panel
    ... This is obviously to launch a program from my panel as I mentioned and ... I'm obviously not root so there is no need to make a script which is ... doesn't require gnome or kde and it solves my problem. ...
    (SuSE)