Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!psuvax1!gatech!ncar!mailrus!cornell!uw-beaver!sumax!amc-gw!pilchuck!ssc!fyl From: fyl@ssc.UUCP (Phil Hughes) Newsgroups: comp.unix.xenix Subject: Re: Generating passwords automatically Summary: here is part of the answer Keywords: password Message-ID: <144@ssc.UUCP> Date: 16 Aug 89 02:25:27 GMT References: <2037@infmx.UUCP> Distribution: usa Organization: SSC, Inc., Seattle, WA Lines: 37 In article <2037@infmx.UUCP>, markj@infmx.UUCP (Mark Jeske) writes: > Is it possible to automatically generating passwords and place the > encrypted form in the /etc/passwd file? I need to create about 1200 > random passwords. I'm running xenix 2.3.2 on a ps/2 model 80. > > Thanks for any help. > > Mark Jeske This is what I use to generate passwords. Fancy, no, but, it works. You can muck with valid to both change what you put in the entry and the distribution (want more numbers, put them in more than once, etc). It seems, however, like you have a lot of other problems like making the rest of the password entry. May I suggest awk? --------------------------------------------------------------------- /* rpw.c -- random password generator */ void strand(); long time(); int rand(); char valid [] = {"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"}; main() { int i; srand((unsigned)time((long*)0)); for(i=0; i<8; i++) putchar(valid[rand() % sizeof(valid)]); putchar('\n'); } -- Phil Hughes, SSC, Inc. P.O. Box 55549, Seattle, WA 98155 (206)FOR-UNIX amc-gw!ssc!fyl or uunet!pilchuck!ssc!fyl or attmail!ssc!fyl