'How do Applications escalate privileges in a gui?

Many apps on my desktop such as my package manager and Virt-Manager ask for my password to in order to do certain function in the app that require root. They do this in two interesting ways. One, they ask for the password of a local adminstrator, or someone in the wheel group. The second thing they do is ask for admin after they launch and in a gui menu. How do I do these things. Do I simply launch the gui app in root (setuid)? Do I create a second executable that has setuid? Thanks.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source