Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can passwords be set in a script?

Status
Not open for further replies.

Blizard

Technical User
Aug 2, 2002
14
US
We are faced with adding multiple users (30-150) users at a time, and need an efficient way to set an initial password for each. passwd does not accept password values as an argument, so that is not an option.

Does anyone know of a command or other way to do this? Our fingers are getting very tired here!
 
I suggest using Expect. IBM Certified -- AIX 4.3 Obfuscation
 
Can you give me a little more detail? I'm not familiar with Expect. Is it a product, command, dessert topping?

Thanks in advance.
 
I suggest the following script to use:

root@/home/root>cat create_user.sh

#!/bin/ksh
cat userlist|awk '{system(&quot;mkuser pgrp=<> groups=<> home=&quot; $5&quot; shell=/usr/bin/ksh login=true gecos=\&quot;&quot;$1&quot; &quot;$2&quot;\&quot; &quot; $3)}'
cat userlist|awk '{system(&quot;setpasswd &quot;$3&quot; &quot;$4&quot;;pwdadm -c &quot;$3)}'

Create the users in a flat file as follows:
root@/home/root>cat userlist

<Firstname> <Surname> <username> <password> <Home directory>

 
Thanks for the response. I can't find any 'setpasswd' command on my machine, or via searches in google, askjeeves, etc. What is it, and where can it be found?

Also, I did find a subroutine newpass that sounds useful, but as I am not a c programmer by trade, I'm loathe to try to put it into a program. Has anybody out there put this in a program?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top