Root access with python

Paul Rubin phr-n2002a at
Mon Mar 25 12:02:58 CET 2002

mtaylor at (Moray Taylor) writes:
> I want to know how to run a 'root' command with python, i.e. mounting
> an NFS drive.
> On the terminal, you would do a 'su', type your password, then enter
> the command you wanted to run. How is this achieved within Python?
> My purpose is to make a small GUI app with PyQT to make mounting NFS 
> volumes easier, I can handle the GUI bit, but I don't understand how
> to 'su'.
> Thanks  for any help

Don't try to do that unless you REALLY know what you're doing with
security implementation.

Instead, run "su" the usual way and type your password to get a root
shell, then launch your GUI app from the root shell.

More information about the Python-list mailing list