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?


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

| improve this answer | |

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}
| improve this answer | |

Can be done in two steps. First create users with useradd command 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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.