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

Grant Edwards grante at visi.com
Fri Jan 23 20:32:17 EST 2009


On 2009-01-24, Linuxguy123 <linuxguy123 at gmail.com> 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 short answer is: you don't accomplish that easily.

The long answer is: you can accomplishity difficultly by using
a pty or the pexect module to execute the su or sudo command.

-- 
Grant




More information about the Python-list mailing list