Docs/shell/tools/unlock-user.sh
2022-10-18 16:59:37 +08:00

19 lines
370 B
Bash

#!/bin/bash
# 解锁用户
# /usr/sbin/pam_tally2 -r -u [username]
if [ $# -eq 0 ];then
echo -e "\033[31;1mUSGE:$0 [username]\033[0m"
exit 1
else
while [ $# -gt 0 ];do
user=`cat /etc/passwd | awk -F ':' '{print $1}'| grep $1`
if [ $user == $1 ];then
/usr/sbin/pam_tally2 -r -u $1
else
echo -e "\033[31;1m$1 is not exists! \033[0m"
fi
shift
done
fi