5

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?

7

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

0

You can create a shell script like this:

#!/bin/bash
echo "Type the username:"
read USERNAME
echo "Type the pass:"
stty -echo
read PWD
stty echo
useradd -p ${PWD} ${USERNAME}
0

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.

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.