Operating System - HP-UX
1827345 Members
6072 Online
109963 Solutions
New Discussion

Re: automating user id and password creation

 
Greg Butler
Occasional Advisor

automating user id and password creation

I have a text file containing userid,username,and password. I need to read this text file and create user ids and passwords. Does anyone have a script that will do this ?
5 REPLIES 5
Craig Rants
Honored Contributor

Re: automating user id and password creation

You will need more than a script. You will need a C program or Perl to randomly generate you password. I have one but can't give it out. You may be able to find some stuff on the web, search for password generation.

MC,
C
"In theory, there is no difference between theory and practice. But, in practice, there is. " Jan L.A. van de Snepscheut
Jeff Machols
Esteemed Contributor

Re: automating user id and password creation

If you want to automatically create passwords, the first thing you need to do is download and install expect. Otherwise, you cannot redirect input into passwd
Mark Greene_1
Honored Contributor

Re: automating user id and password creation

Get a copy of expect as was mentioned, then checkout 'man useradd' and you can use expect to feed the prompts to it from your file.

--
mark
the future will be a lot like now, only later
Rodney Hills
Honored Contributor

Re: automating user id and password creation

I have a similar situation. My script is much more complicated in that I create other items. But to deal with the password, I made a function that will encrypt a plain text password that is suitable for /etc/passwd.

If you are running a "trusted" site or have a shadow password file, then this won't work.

But by generating the encrypted password, I can then edit the /etc/passwd and add an entry directly.

Find attached the C function to encrypt.

-- Rod Hills
There be dragons...
Wodisch
Honored Contributor

Re: automating user id and password creation

Hello Greg,

why not use the which Bill Hassell has contributed over there:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x5f49a22831ebd5118ff40090279cd0f9,00.html
or use the one that Steven Gillard has donated on the same thread...

HTH,
Wodisch