Generating passwords automatically
Phil Hughes
fyl at ssc.UUCP
Wed Aug 16 12:25:27 AEST 1989
In article <2037 at infmx.UUCP>, markj at 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
More information about the Comp.unix.xenix
mailing list