随机定时修改密码change_passwd.sh

change_passwd.sh

#!/bin/sh
/usr/bin/chattr -i /etc/passwd /etc/shadow /etc/group /etc/gshadow
/usr/bin/echo `/usr/bin/date +%Y%m%d%w` |/usr/bin/awk -F '' '{print $1$5$9"Jack_Cui"$3$5$7}' |/usr/bin/passwd --stdin root
/usr/bin/chattr +i /etc/passwd /etc/shadow /etc/group /etc/gshadow

定时任务 crontab -e

#change_passwd
0 10 10,25 * * /bin/sh /srv/change_passwd.sh >/dev/null 2>&1

  

你可能感兴趣的:(随机定时修改密码change_passwd.sh)