How do I add users using Python scripts on a Linux machine

Tim Roberts timr at
Wed Jan 3 08:58:04 CET 2007

"Ramdas" <ramdaz at> wrote:
>I need to add users from a web interface for a web server, which runs
>only Python. I need to add users, set quotas and in future even look at
>managing ip tables to limit bandwidth.
>I know os.system(), but this has to be done through a form entry
>through a web interface.
>Anyways thanks, do advise if there more pythonic solutions

os.system is perfectly Pythonic, and can be executed from a CGI script. The
challenge is becoming root, which is necessary to do what you ask.  You can
write a simple C program that is setuid root that calls your script for
Tim Roberts, timr at
Providenza & Boekelheide, Inc.

More information about the Python-list mailing list