Marcel is right that you can't shut down the system using the shutdown command without root privileges. GNOME panel shut down the system by contacting a daemon with root privileges via DBUS.
So in Gnome (and I think it will also work in KDE) you can shutdown the system by calling the shutdown method on this DBUS Service: org.freedesktop.PowerManagement
other methods available are:Hibernate() ,Suspend(), Reboot()
haven't tested it yet because then I couldn't complete this message :) but it should work... problem is that it might not work on other Desktop envierments.
Marcel is right that you can't shut down the system using the shutdown command without root privileges. GNOME panel shut down the system by contacting a daemon with root privileges via DBUS.
So in Gnome (and I think it will also work in KDE) you can shutdown the system by calling the shutdown method on this DBUS Service: org.freedesktop .PowerManagemen t
code should look something like these:
objectPath = '/org/freedeskt op/PowerManagem ent' p.PowerManageme nt' object( busName, objectPath)
busName = 'org.freedeskto
bus = dbus.SessionBus()
pm = bus.get_
pm.Shutdown()
other methods available are:Hibernate() ,Suspend(), Reboot()
haven't tested it yet because then I couldn't complete this message :) but it should work... problem is that it might not work on other Desktop envierments.