10

I use Eclipse as my IDE, and when I run my application I wish the application itself to run as root. My program currently checks if it is root, and if not it restarts itself with gksudo. The output, however, isn't written to the console. I can't use sudo, since it doesn't give me a graphical prompt. (While my program is CLI, Eclipse doesn't permit console interaction afaict)

What's the "right" way to be elevating my application?

lfaraone
  • 44,680
  • 16
  • 48
  • 70

3 Answers3

3

It may not be an ideal solution, but the rare times that I need this same functionality I end up just running Eclipse as root.

Adam
  • 6,139
  • 2
  • 25
  • 24
2

Restrictive execution dominates. I believe that Eclipse does permit console interaction, but a quick and dirty, brute force approach would be to use suid if you're not concerned about security. Or throw up your own graphical prompt in Tkinter/other and use a bit of Expect magic to spawn and respond to the sudo process. Careful with these, however :)

Cyril Gandon
  • 15,798
  • 12
  • 69
  • 116
JohnMetta
  • 15,334
  • 4
  • 27
  • 55
1

You might need to create a runner with external tools pointing to '/sur/bin/sudo' and pointing to variable ${resource_loc} Run -> External tools -> External Tools Configuration The below link will guide you on creating a external runner,

http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2FgettingStarted%2Fqs-97_standalone_ets.htm

To run, Click on the main python file Run -> External tools -> {choose your runner}

This will serve your purpose.