[comp.unix.admin] Question on changing passwords in batch...

acsiv@menudo.uh.edu (Duck aka D. Harper) (05/24/91)

Morn, Folks!
  We have a number od trainging accounts that we need to change  the
passwords on a regular basis.  I was woundering if there is any way to
do it in batch.  We are running ULTRIX 4.0 on a DEC 5830....

Thanks!

Don

-- 
Donald M. Harper   (713) 749-6283 
University of Houston Academic User Services, User Services Specialist II   
Cannata Research Computing Center, Operator
Internet : DHarper@uh.edu | Bitnet : DHarper@UHOU  | THEnet : UHOU::DHARPER

jch@hollie.rdg.dec.com (John Haxby) (05/31/91)

You could use awk on the password file.  Something like this:

	awk -F: '
		/^first:/	{ PASSWORD=$2; print $0 }
		/training_user/	{ print $1 ":" PASSWORD ":" ... }'

and you need to worry about printing the other entries in the
password file as well.  This way you change the first training
user's password and run this little command to copy it into all
the others.  If you have a hashed password data base, you'll
need to run /etc/mkpasswd by hand.  You could get clever
and run /etc/lockpw and /etc/unlockpw while you are
changing the password file.  If you have a distributed password
file, you'll have to change the master copy and then
persuade hesiod or yp (or whatever) to re-distribute the file.
-- 
John Haxby, Definitively Wrong.
Digital				<jch@wessex.rdg.dec.com>
Reading, England		<...!ukc!wessex!jch>

----------------------------------------------------------------
The opinions expressed herein are my own, not my employers.