Please correct me if I am wrong. When we try to shutdown or reboot from terminal by using sudo init 0, sudo init 6( or any other command for the same purpose ) commands we need be root to perform these task but when we do the same thing from Ubuntu( I guess the same thing with most of the Desktops ) UI, it just don't ask any root permission for either of the tasks.
What kind conversation/mechanism is happening in side here ?