I need to create bunch of new users with given password. What I want is a script that I would pass the user name of new user and it will create/add the user and set its password. (the password is the same for all new users - no security issues here.)

Any suggestions how to do that on SuSE from command line?

4 Answers 4


Does SuSE useradd have the -p option? That takes the password (albeit in encrypted form, but you should be able to generate that I think).

So useradd -p <crypt'ed password> <new username> should do it I think


You can create a shell script like this:

echo "Type the username:"
echo "Type the pass:"
stty -echo
read PWD
stty echo
useradd -p ${PWD} ${USERNAME}
for i in `cat userlist`
useradd $i
echo "$i:your_password"|chpasswd

userlist should contain list of users to be created.

  • Welcome to the site, and thank you for your contribution. Please note, however, that the "backtick"-style for command substitutions is deprecated, and the $( ... ) style should be used instead.
    – AdminBee
    Aug 5, 2020 at 15:11

Can be done in two steps.

  1. First create users with useradd command
  2. On the second run something like this
    cat 1.txt | while read line; do echo "12345" | passwd --stdin $(echo ${line}); done
    where 1.txt is a file containing the list of logins.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .