How to give password in shell script for user creation


HI Team,

I am planning to create 1000 user on one my linux system using the shell script.

The issue i am facing how can i give password to all the users automatically.

useradd test1
passwd for All user is 12345

IF i type passwd command it will expect output from user. How to provide password “12345” automatically to all user.

Please help on this


It’s very simple

i=use1 use2 user3 …user100
for i in 100
echo “password” | passwd “$i” --stdin


Thank you so much Narendra. This is what exactly i am looking for


for i in seq 1 100
useradd user$i
echo “password” | passwd “user$i” --stdin