Hi,
Is there an shell script/batch file to genarate random passwords which expires after a stipulated time period? Please suggest a software which does this for AIX and windows both else.
Thanks.
Hi,
Is there an shell script/batch file to genarate random passwords which expires after a stipulated time period? Please suggest a software which does this for AIX and windows both else.
Thanks.
I don't understand your requirement completly. To generate a random passwd you can use the bellow perl script . You can modify it as per your requirement.
#!/usr/bin/perl
sub randomPassword {
my $password;
my $_rand;
my $password_length = $_[0];
if (!$password_length) {
$password_length = 10;
}
my @chars = split(" ",
"a b c d e f g h i j k l m n o
p q r s t u v w x y z A B C D
E F G H I J K L M N O P Q R S
T U V W X Y Z - _ % # | 0 1 2
3 4 5 6 7 8 9 ! ? $ @");
srand;
for (my $i=0; $i <= $password_length ;$i++) {
$_rand = int(rand 71);
$password .= $chars[$_rand];
}
return $password;
}
print "\n\nRandom Password = ", randomPassword(9);
print "\n\n";
Hi Amit,
Thanks for your reply.
I will again put forth my requirement. I want a random password generator which generates a password.Then we want it should be allocated to a user(He may be oS or databse user on the AIX).Also we want that this password should expire within a specifeid time(say for example 6hrs on in 24 hrs). As we want to provide this account access temporarily for some set of works only. Hope I am able to claer all your doubts this time.
I want to achieve all these activities through a shell script. Please help.
Activities as:
1)Generate a random apassword to a already exsisting user(OS or DB user)
2)In case its a db user......it should 1st connect to DB and then allocate the password.
3) Password should expire in a stipulated time
Thanks.
Hi,
Any suggestions on this query.
Thanks
now you already have the script for passwd generation on random.
Now using expect u can change the current passwd with ur random passwd .
And for setting the expiration of passwd please check the man pages of "chage".
Try to proceed with this info . Let us know if you face any issue.
KR
Amit
Hi,
Thanks for your suggestion.
I am not so good at shell script.Can you please suggest how should I take the generated password and assign it to the userid using expect. Please provide the outline script to do so if avaialble.