Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

1 Answer 1

up vote 5 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
1  
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

 
discard

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.