Pages

Tuesday, April 19, 2011

Xem password User thay doi khi nao ( Last Change Password)

- Xem password cua User thay doi khi nao

root@ubuntu:/thien# nano lastchange.sh

#!/bin/sh

IFS=:
today=`expr \`date +%s\` / 60 / 60 / 24`
while read a b c d e f g h i; do
if [ "$b" != '*' -a "$b" != '!!' ]; then
last=`expr $today - $c`
echo "$a = `date --date "-$last day" +%Y/%m/%d`"
fi
done < /etc/shadow

root@ubuntu:/thien# chmod 777 lastchange.sh

root@ubuntu:/thien# ./lastchange.sh
[: 10: !=: unexpected operator
[: 10: !=: unexpected operator
ubuntu = 2011/04/19
root@ubuntu:/thien#

No comments: