Python Programming expert - adding user

William R. Wing (Bill Wing) wrw at mac.com
Thu Jul 19 14:22:17 CEST 2012


On Jul 17, 2012, at 9:58 PM, Maria Hanna Carmela Dionisio wrote:

> Im just a student :)
> 
> Our prof gave as a task that we need to make a program using python (for redhat) and c++(for windows)
> 
> Our objective is to make a program file and we will said it remotely to another computer via network ( its easy and i could do it lolz)..
> 
> the hard part is the programming..that when the user click the file a box will prompt and ask for username and a password(even without a password) then the username that he inputted will add to the user account of his/her computer :DD
> 
> HELP HELP EXPERTSSSSSSSSSSSSSS
> 
> THANKS :D
> -- 
> http://mail.python.org/mailman/listinfo/python-list

I'm sorry if I'm not understanding exactly what your professor wants, I think he is asking you to add a new user to the list of possible users of the computer - that is, add a new user account.  If so, then the answer is pretty simple, since Linux (Red Hat) has a "useradd" command that you just have to supply inputs to.  Your python program will start by importing "subprocess" and then using it to spawn a child process in which the useradd command will run.

Read the subprocess documentation here:

	http://docs.python.org/library/subprocess.html?highlight=subprocess#subprocess

and see if this, plus the man page for useradd, doesn't get you going.

-Bill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120719/c7a08e64/attachment.html>


More information about the Python-list mailing list