Ok, i solved it, you have to do some terminal stuff to allow non root users to shut the computer down, basically i did what is described here in the sudo section: http://www.spencerstirling.com/computer-…-tdown.html
In Ubuntu, you could always use gksudo (or kdesudo for KDE) at the beginning of the system() session to grab Super User rights through a graphical interface. For vanilla Ubuntu, which uses GNOME, use gksudo, and for Kubuntu, use kdesudo. You would accomplish this like so:
well I needed it to just shut down without any interface or callback. If you can live with a GUI confirmation window your solution is easier then writing custom rights i guess
One way might be to have a password file that is read by the program (via ofxXmlSettings or some other file reader) to get your password, and then do this:
(Although the sudo input prompt may be staggered to block password injections this way…)