|
|
|
|
|
by chasil
3289 days ago
|
|
Here is what I use (notice that I omit zero and the letter O): $ ./LinPass.sh luser xTJ2B2X3 $ ./LinPass.sh luser JzILD3qd $ ./LinPass.sh luser IzlXki81 $ cat LinPass.sh #!/bin/bash id "${1}" > /dev/null if [[ $? -ne 0 || -z "${1}" ]] then echo -e "Usage: $0 logname [pw]\n\treset logname's
pw & force chg" exit
fiif [[ -z "${2}" ]] then while [[ $pw != [A-NP-Za-np-z]* ]] || # Begins with a letter [[ $pw != *[1-9]* ]] || # Has a number
[[ $pw == *[^A-NP-Za-np-z1-9]* ]] # Has nothing else
do pw=$(openssl rand -base64 6) # Safe random source
done
else pw="${2}"fi #echo "${pw}" | passwd --stdin "${1}" #chage -d 0 "${1}" echo "${pw}" #http://brandonhutchinson.com/wiki/Linux_Password_Policy
#chage -m 7 -M 90 -W 14 hutchib; #chage -M 85 -W 5 -I 5 "${1}" |
|