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]
Comment=configuration loader
Exec=sudo loader

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.


I ended up using (after installing gksu)

Exec = gksu myprogram

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

Answered By – user1764386

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published