Unix script to validate a password, the password should be at least 8 characters long, should be alphanumeric, should contain lower case and upper case letters. If any of these conditions are not met, the script should flag the password as "weak password"
-
3What have you tried? Where's your code? What's causing the problem? We will help you fix an honest attempt to solve the problem — we won't write the code for you. One of the bigger issues with this program is "how do you get the password to the script without exposing it to snoopy programs?" Don't use a command line argument to hold the password to be tested.Jonathan Leffler– Jonathan Leffler2019-02-08 05:16:34 +00:00Commented Feb 8, 2019 at 5:16
-
Does this answer your question? stackoverflow.com/questions/20845497/…Andrei Lupuleasa– Andrei Lupuleasa2019-02-08 07:17:17 +00:00Commented Feb 8, 2019 at 7:17
-
@AndreiLupuleasa, Please find below my answer: #!/usr/bin/ksh export v_pwd=$1 l_pwd=${#v_pwd} echo ${l_pwd} echo ${v_pwd} if [[ $l_pwd -ge 8 ]]; then if [[${v_pwd} =~ [a-z] ]] && [[ ${v_pwd} =~ [A-Z] ]] && [[ ${v_pwd} =~ [0-9] ]]; then echo "valid paasswd" else echo "not a valid pwd" fi else echo "not a valid pwd" fiaravind murali– aravind murali2019-04-30 08:11:35 +00:00Commented Apr 30, 2019 at 8:11
Add a comment
|