How do I get my python program to get the root password ?

Aahz aahz at
Sat Jan 24 05:27:50 CET 2009

In article <mailman.7854.1232759225.3487.python-list at>,
Linuxguy123  <linuxguy123 at> wrote:
>I want to make a python program that I can run as a normal user that
>changes the permission on some device files.  It will need to ask me for
>the root password and then run chown as root in order to do this. 
>How do I accomplish this (easily) ?

The easiest -- really -- is to just make it a root script and run it with
sudo.  If you're on Ubuntu, that's pretty much the only option (without
resorting to complicated ways of running sudo) -- the standard Ubuntu
setup doesn't have a root password.
Aahz (aahz at           <*>

Weinberg's Second Law: If builders built buildings the way programmers wrote 
programs, then the first woodpecker that came along would destroy civilization.

More information about the Python-list mailing list