Find the answer to your Linux question:
Results 1 to 4 of 4
If this is the wrong place to ask, just move it. So many categories So, I'm writing a program that needs root-privileges to run properly. I made a .desktop file ...
  1. #1
    Just Joined!
    Join Date
    Feb 2008
    Posts
    2

    gksu, kdesu, gnomesu, gksudo, ...

    If this is the wrong place to ask, just move it. So many categories

    So, I'm writing a program that needs root-privileges to run properly. I made a .desktop file that sits in /usr/share/applications. I'm running Ubuntu Gutsy and Mandriva 2008, so in Ubuntu I use as a starter:
    gksu /usr/bin/xmple
    and under Mandriva I use:
    kdesu /usr/bin/xmple
    But Kubuntu also needs kdesu, but the Mandriva package won't work under Kubuntu, so I need 2 Ubuntu packages. One for Gnome and one for KDE.

    Isn't there a general term to call root in Linux, one that doesn't depend on which distro or desktop envirement you use?

  2. #2
    Linux Newbie
    Join Date
    Jan 2008
    Location
    UK
    Posts
    211
    maybe I do not quite understand but if your program just needs root privileges, and not kde or gnome can you not use a script to execute and use su in the script, or write a script that checks what system it is on and then executes the appropriate command.

  3. #3
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    If you need root privileges, I would recommend forcing this onto the user. You can do something like the following:
    Code:
    if(geteuid() != 0)
        fputs("I have to be run as root!\n", stderr);
    You could instruct the user on how to do this (sudo / su), or instruct them on how to set the suid bit.
    DISTRO=Arch
    Registered Linux User #388732

  4. #4
    Just Joined!
    Join Date
    Feb 2008
    Posts
    2
    Well, if I have to do it with a script, then it has to be done before installation, right? Because I made packages (deb,rpm) and they put the .desktop file in place, so it wouldn't matter anymore if I run a script at startup of the program.

    I wonder how other programs do this kind of stuff, but I didn't find an example yet.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...