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

18 lines
485 B
Bash

#!/bin/bash
## 密码过期续期
# /usr/bin/chage -M 180 [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/bin/chage -M 180 $1
else
echo -e "\033[31;1m$1 is not exists! \033[0m"
fi
shift
done
fi