#! /bin/sh # # Script to allow root to adjust expiration date of all passwords. # The default date of last password change must be hand coded on the next line: default="12/12/98" users="/tmp/users.$$" if [ `whoami` != "root" ] then echo "Only root can run this script" exit 1 fi current=`pwd` cd /users ls > $users cd $current # Store standard input in 4 exec 4<&0 while read id do # Put current (file) input in 5 exec 5<&0 # Switch to tty input: exec 0<&4 finger $id chage -l $id echo "Press y to switch this user to $default for last password change" echo "or press n to skip:" read key if [ "$key" = "y" ] then chage -d $default $id chage -l $id fi # Switch back to file input: exec 0<&5 done < $users rm $users exit 0