a) The EXPECT language (part of the Tcl/Tk languages) was created to 
***mimic*** a user's responses to an interactive program (like ftp, passwd, 
etc).
b) Suresh's perl hack is really long for such a simple task!  I've seen a lot 
of perl hackers doing the same thing.  Python has a simpler way to do it.
c) Try the following expect script (modify it after learning the flow)

#!usr/bin/Expect
set username [lindex $argv0]
set password putyourgenericpasswordhere
spawn passwd $username
expect "Enter new password: "
send "$password\r"
expect "Retype new password: "
send "$password\r"

d) The above script will reduce the effort of typing the password everytime, 
twice for each user.  You will need to run it from the bash prompt 
[#scriptfilename username] for each user.  With a little effort the above 
program can be put into a loop so that the list of users can be done at one 
go.  Neat, huh!
RKA

Original Message From Suresh Ramasubramanian <[EMAIL PROTECTED]> =====
>Sandeep Singh Cheema rearranged electrons thusly:
>
>> i want to set predetermined passwords for some 150 users on my server. how
>> can i automate the task? i heard expect can make interective scripts, but 
cd

Visit me at http://princeandy.webjump.com


----------------------------------------------
An alpha version of a web based tool to manage
your subscription with this mailing list is at
http://lists.linux-india.org/cgi-bin/mj_wwwusr

Reply via email to