Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
When you try to do a privileged systemd operation without the privilege, you get an escalation prompt: $ systemctl stop docker ==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ==== ...
#1: Initial revision
Privilege escalation from Python like from systemd
When you try to do a privileged systemd operation without the privilege, you get an escalation prompt: ``` $ systemctl stop docker ==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ==== Authentication is required to stop 'docker.service'. Authenticating as: [MY USER NAME] Password: ``` I've seen some other programs do this as well (don't recall which), so it seems like not a systemd-specific thing. I want to write a Python program that occasionally does privileged things. *Most of the time* it does not do privileged things, so I don't want to tell users to run my program with sudo. Instead I want to ask for the escalation as needed, like `systemctl` does. Is it possible in Python?