[CentOS] help - batch account creation

Mon Aug 3 19:58:46 UTC 2009
David Leon <dleon741210 at gmail.com>

thanks, I will try this, it looks like what I'm looking for


On 8/3/09, a arias <aarias239 at gmail.com> wrote:
> Try this:
>
> while true
> do
>        read username passwd
>        if [ "$username" == "" ]
>        then
>                exit
>        fi
>     passwd_hash=$(openssl passwd $passwd)
>     echo "Using the following password hash for user "$username":
> $passwd_hash"
>     /usr/sbin/useradd $username -p "$passwd_hash";
> done
>
> use the script like this:
>
> add_multiple_users.sh < /path/to/userlist.txt
>
> Don't forget to make the script executable:
>
> chmod +x add_multiple_users.sh
>
>
>
> On Mon, Aug 3, 2009 at 2:56 PM, nate <centos at linuxpowered.net> wrote:
>
>> David Leon wrote:
>> > I'm trying to avoid typing every password manually. I just need an
>> > script that makes the job.
>> >
>> > useradd creates the account but still need to setup accpunt's password.
>> >
>>
>> from 'man passwd'
>>
>>       --stdin
>>              This option is used to indicate that passwd should read the
>> new password from standard input, which can be a pipe.
>>
>>
>>
>> _______________________________________________
>> CentOS mailing list
>> CentOS at centos.org
>> http://lists.centos.org/mailman/listinfo/centos
>>
>