[pygtk] running pygtk application with root privileges

Johan Dahlin jdahlin at async.com.br
Sat Mar 17 00:28:23 WST 2007


> I'm building an application that needs to change configuration files in
> the /etc and in the /usr directories like the dhcp.conf file.
> Any user should be able to run this application but to changes those
> files root privileges is needed.
> 
> How can I run pygtk application in root (setuid) mode or how can I ask
> the user to enter the root password (in the pygtk env.) and then run the
> application?

You cannot run GTK+ application as setuid root, there's a check inside GTK+
itself that forbids you from doing that. The reason is that there are
several known "backdoors" for someone to regain root if you do so.

-- 
Johan Dahlin <jdahlin at async.com.br>
Async Open Source


More information about the pygtk mailing list