Need some help please

William Park opengeometry at NOSPAM.yahoo.ca
Mon Jul 22 12:35:35 EDT 2002


Arneau Starl <as at ctes.com> wrote:
> I have a stripped down (minimal software on it) ftp server that does
> have python 2.2 on it..  Here is what I need to do:
> 
> There is no gui on this redhat machine so I need to have a simple
> commandline process to add ftp user accounts  I could do this by hand
> but then I would have to make them all , I need be be able to make it
> easy so  another less unix savvy person can create accounts
> 
> I need to be able to execute a python script (mkacnt) with 2
> arguments username and email address. The script does 4 things
> ("mkacnt name email") 1: create ftp user account with "adduser" 2:
> create random password 3: execute "passwd username " and then update
> the password with the one just generated. 4: Email the username and
> password to the email address supplied above.
> I have 1 ,2 & 4 working I cannot figure out a way to do the password
> without Expect (which I cannot install on that machine).  Is there a
> way around this?

- insert the password into /etc/passwd and /etc/shadow directly. 

- pipe your commands into Telnet session (or Python equivalent thereof)
    ( 
	echo login-password;	sleep 5
	echo su;		sleep 5
	echo root-password;	sleep 5
	echo passwd username;	sleep 5
	echo login-password;	sleep 5
	echo new-password;	sleep 5
	echo new-password
    ) |  telnet -l user localhost

- there may be other simple solution using I/O redirection on the console
  directly.

-- 
William Park, Open Geometry Consulting, <opengeometry at yahoo.ca>
8-CPU Cluster, Hosting, NAS, Linux, LaTeX, python, vim, mutt, tin



More information about the Python-list mailing list