Python & Linux, some questions

Mathias Waack M.Waack at
Sun Mar 14 21:52:46 CET 2004

Luca T. wrote:
> 1) I need to run some linux commands (from inside my app) that
> require superuser privileges (mkfs, losetup, etc), how do i do
> that? (I do not want to run my app with root privileges, but it
> will just ask the user for the root password before proceeding)

man sudo(1), su(1) or setuid-bit (chmod(1))

> 2) When i execute the command i need to read its output (especially
> the error messages) to know if everything went fine but i do not
> know how :

see the popen family of functions in the Python library.

>( 3) How can i know if the user that is running my app is
> root or normal user?



More information about the Python-list mailing list