Superuser authority (again)

Wouter van Marle wouterm at spammers-unite-here.com
Tue Feb 11 22:54:48 EST 2003


Thanks, I will have a look at it. Same for the sudo command.

Then the main thing is that I still have to give the password one way or
another. I will do a man when I am home (company of course runs windoze...).

Wouter.


"Michele Simionato" <mis6 at pitt.edu> wrote in message
news:2259b0e2.0302110923.7520c751 at posting.google.com...
> "Wouter van Marle" <wouterm at spammers-unite-here.com> wrote in message
news:<b29upv$7du4 at imsp212.netvigator.com>...
> > 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.
>
> IIRC, on linux, you can can go with
>
> os.system("su -c 'python
script_doing_what_I_want_with_root_permissions.py'")
>
> (not sure 100%). Hope this helps,
>
>                                         Michele






More information about the Python-list mailing list