Article 4YPP2 Selecting special characters

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 PasswordSeleclatest?d=yIl2AUoC8zA latest?i=897gCOtAh4E:UDbYcFlYhqM:F7zBnMy latest?i=897gCOtAh4E:UDbYcFlYhqM:V_sGLiP latest?d=qj6IDK7rITs latest?i=897gCOtAh4E:UDbYcFlYhqM:gIN9vFw897gCOtAh4E
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments