Question on changing passwords in batch...

John Haxby jch at hollie.rdg.dec.com
Fri May 31 18:17:05 AEST 1991


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 at wessex.rdg.dec.com>
Reading, England		<...!ukc!wessex!jch>

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



More information about the Comp.unix.admin mailing list