#!/bin/bash
#checkroot
if [ "$(id -u)" -ne 0 ]; then
echo "This script must be run as root"
exit 1
fi
#username
USER="yunwei001"
# 设置密码过期日期
chage -E 2025-08-01 $USER
# 设置新密码
echo "$USER:AbC1!2@3#D4$f523" | chpasswd
# 检查命令是否成功执行
if [ $? -eq 0 ]; then
echo "Password expiration date set and password changed successfully for user $USER"
else
echo "An error occurred while setting password expiration date or changing password for user $USER"
fi