Operating System - HP-UX
1834601 Members
3899 Online
110069 Solutions
New Discussion

Random generated password for new account

 
SOLVED
Go to solution
Wendy_9
Frequent Advisor

Random generated password for new account

Hi all,

My system is a trusted system. When I create the user in SAM, it gives me the initial password more than 20 characters.

Is there any setting that can minimized the password to 8-10 characters?

Regards,
Wendy
3 REPLIES 3
V.Tamilvanan
Honored Contributor
Solution

Re: Random generated password for new account

Hi,
Yes. You can minimised the password length. So according to this following procedure.

#sam--> Auditing and Security --> system Security policies-->password format policies . Specify Max password length .


HTH
Rainer von Bongartz
Honored Contributor

Re: Random generated password for new account

edit the file

/etc/default/security
and add a line like

MIN_PASSWORD_LENGTH=8

Regards
Rainer
He's a real UNIX Man, sitting in his UNIX LAN making all his UNIX plans for nobody ...
Geoff Wild
Honored Contributor

Re: Random generated password for new account

Or you can generate your own....here's some C code to do just that:

/* Takes a command-line arg, and generates that many random 8-char passwords */


#include
#include
#include
#include
#include

#define BAD_PASSWD_CHARS "<>&1l0O#@"
#define GOOD_NUMS "0123456789"

main(int argc, char **argv)
{
char password[9];
time_t today_t;
short rand;
int x,y,number;

if (argc < 2)
{
printf("\n Usage: randpass \n\n");
exit(1);
}

for (x = 0; x if (!index(GOOD_NUMS,argv[1][x]))
{
printf("\nInvalid number!\n\n");
exit(1);
}

number = atoi(argv[1]);

time(&today_t);
srandom(today_t);

for(y = 0; y < number; y++)
{
for (x = 0; x < 8; x++)
{
rand = 0;
while (rand < 33 || rand > 126 || index(BAD_PASSWD_CHARS,rand))
{
rand = random();
rand /= 100;
}
password[x] = rand;
}
password[8] = '\0';
printf("Password %d: %s\n",y+1,password);
}
}


Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.