Script required

Carl T. Miller carl at carltm.com
Fri Nov 5 00:34:04 UTC 2010


Jonathan Billings wrote:
> On Nov 4, 2010, at 5:52 PM, nani wrote:
>> Is there any way to provide password from the bash script, please let me
>> know the script
>
> You probably could use 'expect' (which uses Tcl) to automate interacting
> with the script.  This isn't a bash script, but you'll be able to interact
> with the ksh script as if it were an interactive process.  If you don't
> like tcl, there are Python and Perl expect modules as well.

Or you could investigate the --stdin option for passwd
which will accept a string from a piped command.  Something
like this might work:

while read Username Password; do
  echo "$Password" | passwd --stdin $Username
done << somefile

c





More information about the redhat-list mailing list