You might also want to look at the chpasswd utility, which does exactly
what you want (update passwords in batch mode) and has the option to
work with pre-encrypted passwords.
This utility is included in Debian Sarge and Etch; I'm not sure about
other distros.
Sascha
Jeff Forcier wrote:
> On 10/1/07, Steve Kemp <steve_at_steve.org.uk> wrote:
>
>> My initial inclination would be to have a role script to add
>> the accounts, but not in the way that you're currently doing
>> (with 'passwd'). Instead have a script which takes an
>> input file of:
>>
>> username:password
>>
>> (Ideally a salted + crypted password which the role script
>> could update directly via 'pwconv' / 'usermod'?)
>
> The same rough idea (noninteractive input via file) occurred to me as
> well; it's not as braindead-easy as interactive prompting, but at the
> same time it also allows for reuse of the requested user/pass
> combinations (theoretically such a script could still take additional
> args narrowing down which entries in the file it executes). Which
> would be nice and, at least for me, more effective in the long run
> anyways.
>
> Wasn't aware of 'pwconv' so that will give me more manpages to read, thanks.
Received on Tue Oct 02 2007 - 16:13:49 BST