Superuser authority (again)

Wouter van Marle wouterm at spammers-unite-here.com
Mon Feb 10 23:41:17 EST 2003


Hi all.

I have a similar problem as outlined by Tim Daneliuk in the thread a few
weeks ago - I need to perform some superuser action. I was already so far
(before reading the thread) to not want the script to know the password -
the user will have to give this password. This also because the script will
have to be distributed.

Background: I have a fax application, and want it to interact with the
mgetty and sendfax config files. Also I want to write an automated
installer. Reading those config files of course works fine, now I want the
program to also be able to write to these files. That requires root
permissions.

So what I am thinking of: when the user has changed some setting and wants
to save those files, he will have to give the root password.
Basically all the script has to do as root, is invoke a copy command, to
copy the updated config file from the user-writable temporary directory, to
the /etc/mgetty+sendfax directory.
Same for the installation: files can first be stored in the temp directory,
and then copied to the final destination.

How to do this 'copy with root permissions'? And related: setting the
correct ownership of the files (with root permissions again).

Secondly I would like to know what you think about having the user give the
password for every single action (copying and chown-ing of a batch counting
as a single action), or once per session?

Wouter.






More information about the Python-list mailing list