Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 6 down vote accepted

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

share|improve this answer
Yes, it does have it. -p password Encrypted password as returned by crypt(3) any idea how I can generate it from a text? – Radek Jul 17 '12 at 4:56
This site appears to have everything you need: cyberciti.biz/tips/howto-write-shell-script-to-add-user.html – lxop Jul 17 '12 at 5:03
Works smoothly, thank you. – Radek Jul 17 '12 at 5:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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