Summary: (FAQ?) Set password from script. (fwd)

From: Eric Shafto (
Date: Wed Oct 09 1996 - 00:43:26 CDT

Original Query:

> Solaris 2.3. I know I've seen this question asked before, probably on
> this list. How can I write a Perl (or shell, for that matter) script to
> set passwords? See, I'm creating a couple hundred or so users, each with
> different passwords, and I really don't want to do it by hand.

3 basic categories of answer (out of 12 answers total -- you folks are

Category 1: Wrong
These included various schemes for echoing the passwords to passwd from a

Category 2: Expect
Download, compile, and install Tcl and Expect. There's an example called
autopasswd in the examples dir of the Expect distribution which does
exactly what I wanted.

Category 3: Perl functions
There are Perl functions that mimic the C functions for getting and
setting shadow password records, as well as ones that do des encryption.

I went with #2. In retrospect, Perl probably would have been quicker,
since I already had it installed on my system, but I wanted to play with
Expect anyway, and it really is the right tool for the job.

Thanks to everyone who responded.

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:11:11 CDT