【嵌入式】Linux 用户认证壳子
#/bin/sh
trycount=3
while [ 1 ];
do
echo "Please enter $USER key:"
read key
echo "Your key is $key!"
mshadow=`cat /etc/shadow | grep "^$USER" | awk -F ':' '{print $2}'`
if [ "x$mshadow" == "x`echo $key | md5sum | awk '{print $1}'`" ];
then
echo "login success!"
/bin/sh
else
echo "password err!"
let 'trycount--'
if [ $trycount -le 0 ];then
exit -1;
fi
echo "You can try $trycount times for passwod!"
fi
done