Try this:<br><br><div style="margin-left: 40px;">while true<br>do<br>       read username passwd<br>       if [ "$username" == "" ]<br>       then<br>               exit<br>       fi<br>    passwd_hash=$(openssl passwd $passwd)<br>
    echo "Using the following password hash for user "$username": $passwd_hash"<br>    /usr/sbin/useradd $username -p "$passwd_hash";<br>done<br></div><br>use the script like this:<br><br><div style="margin-left: 40px;">
add_multiple_users.sh < /path/to/userlist.txt<br></div><br>Don't forget to make the script executable:<br><br><div style="margin-left: 40px;">chmod +x add_multiple_users.sh<br></div><br><br><br><div class="gmail_quote">
On Mon, Aug 3, 2009 at 2:56 PM, nate <span dir="ltr"><<a href="mailto:centos@linuxpowered.net">centos@linuxpowered.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">David Leon wrote:<br>
> I'm trying to avoid typing every password manually. I just need an<br>
> script that makes the job.<br>
><br>
> useradd creates the account but still need to setup accpunt's password.<br>
><br>
<br>
</div>from 'man passwd'<br>
<br>
       --stdin<br>
              This option is used to indicate that passwd should read the<br>
new password from standard input, which can be a pipe.<br>
<div><div></div><div class="h5"><br>
<br>
<br>
_______________________________________________<br>
CentOS mailing list<br>
<a href="mailto:CentOS@centos.org">CentOS@centos.org</a><br>
<a href="http://lists.centos.org/mailman/listinfo/centos" target="_blank">http://lists.centos.org/mailman/listinfo/centos</a><br>
</div></div></blockquote></div><br>