clinuxubuntudebianxfce

Editing .desktop file to run executable as root?


I have compiled a c program into an executable that I would now like to integrate into the applications menu in Debian 7.4 XFCE. In order to run the application under normal circumstances, I am required to type

sudo myprogram

Now I have created my .desktop file and placed it in /usr/share/applications

[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=myprogram
Comment=configuration loader
Exec=sudo loader
Icon=/usr/share/icons/hicolor/48x48/apps/myprogram.png
Terminal=false
Categories=Development;IDE

The item is added to my applications menu as expected, and the icon shows up properly. The problem, however, is that double clicking the menu item to launch the application does nothing.

If I navigate to /usr/bin (where I have placed my executable) and type "sudo myprogram", the program launches as expected.

What can I do to fix this issue and get the program to launch from the menu? Perhaps /usr/bin is not the correct place to put it, or I have the incorrect Exec command. I greatly appreciate the help.


Solution

  • I ended up using (after installing gksu)

    Exec = gksu myprogram
    

    this launches a graphical sudo prompt, which is sufficient for my needs.