[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::digital_unix

Title:DIGITAL UNIX(FORMERLY KNOWN AS DEC OSF/1)
Notice:Welcome to the Digital UNIX Conference
Moderator:SMURF::DENHAM
Created:Thu Mar 16 1995
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:10068
Total number of notes:35879

9038.0. "Change Password for many users ?" by NETRIX::"[email protected]. co.kr" (Seung-Joo Lee) Wed Mar 05 1997 09:04

I'd like to add 20,000 login accounts for University's students. 
I have a database of them. There are username, home directory and 
initial password in the DBfile. 

It is simple to add 20,000 login accounts with shell script
like the following;
 1. Shell Script File, add.sh:
 ----------
 while :
 do
    read USERNAME HOMEDIR
    /usr/sbin/useradd -m -d $HOMEDIR/$USERNAME $USERNAME
 done
 -----------
 2. Run :
 $ add.sh < DBfile
 where DBfile consists of 20,000 lines with user name and home directory. 
This script works well.

But, useradd command does not have password string option.
And when I tried to change password of a user with passwd command 
and redirection it does not work. That was;
 $ passwd userid < passwordfile
 where passwordfile have two same strings in two lines.

By the way it is impossible to set manually initial password 
with passwd command for 20,000 accounts.

My customer want to set password for each 20,000 userid.
Do you have any idea?

Regards.

Seung-Joo Lee
TS, Digital Korea
[email protected]
[Posted by WWW Notes gateway]
T.RTitleUserPersonal
Name
DateLines
9038.1ZEKE::ranger.zko.dec.com::dilsworthKeith DilsworthWed Mar 05 1997 13:019
A bourn shell script can't run /bin/passwd.  It can invoke
an expect script which can interface with /bin/passwd to 
set the password.

The easiest way to do this is with a Perl script. Perl has 
a crypt function and can generate the passwd field bypassing
/bin/passwd.


9038.2See note 9019NETRIX::&quot;[email protected]&quot;Ann MajeskeWed Mar 05 1997 14:071
[Posted by WWW Notes gateway]