不求甚解

此博客为个人学习之用,如与其他作品雷同,纯属巧合。

导航

验证root口令脚本

Posted on 2022-04-13 09:59  三年三班王小朋  阅读(92)  评论(0编辑  收藏  举报

验证root口令脚本

#!/bin/bash
PWD=12321
if test -z $PWD;then
read -p "输入 root 用户的口令: " PWD
fi
while true;do
echo " root 口令验证中..."
su  oracle -c "echo $PWD|su root">/dev/null 2>&1
if test $? -eq 0;then
echo "验证成功"
exit
break
else
echo  "验证失败!"
read -p "输入 root 用户的口令: " PWD
fi
done