Selecting special characters
by cbtshare from LinuxQuestions.org on (#4YPP2)
Hello All,
I have a task to change users password and send the email to them on a VPN box.The issues I am having is that some password created has special characters that linux has issues variablizing Code:$newpassword= mkpasswd(-length => 15, -minnum => 4, -minlower => 4, -minupper => 2, -minspecial => 3);So if the above generates a password like below and stores it in a variable
Code:122SDfe$%"'\n,it throws an error system qq {echo -e "$newpassword\n$newpassword" | passwd $username}; So this would be easier below:
Code:my @alphanumeric = ('A'..'Z', '*', '!' ,':', '>', 0..9);
my $randpassword = join '', map $alphanumeric[rand @alphanumeric], 0..
+13;
print "$randpassword\n"
but how do I get it to always have a special character in the generated password? Thank you
Comment on Selecting PasswordSelec


I have a task to change users password and send the email to them on a VPN box.The issues I am having is that some password created has special characters that linux has issues variablizing Code:$newpassword= mkpasswd(-length => 15, -minnum => 4, -minlower => 4, -minupper => 2, -minspecial => 3);So if the above generates a password like below and stores it in a variable
Code:122SDfe$%"'\n,it throws an error system qq {echo -e "$newpassword\n$newpassword" | passwd $username}; So this would be easier below:
Code:my @alphanumeric = ('A'..'Z', '*', '!' ,':', '>', 0..9);
my $randpassword = join '', map $alphanumeric[rand @alphanumeric], 0..
+13;
print "$randpassword\n"
but how do I get it to always have a special character in the generated password? Thank you
Comment on Selecting PasswordSelec