20100421: changelin.sh
by dervish on Apr.21, 2010, under Linux, Scripts
#!/bin/sh
# 20100421 – Created by Jamey Hopkins
echo
echo “Change Users Linux/AIX Password”
echo
if [ “$1” = “” ]
then
echo need server list
echo example: $0 servers.txt
echo
exit
fi
if [ ! -f $1 ]
then
echo “Server list $1 not found.”
echo
exit
fi
echo -n “Enter Users Login: ”
read LOGIN
echo “Enter new password”
echo -n “Password: ”
stty -echo
read PASS1
stty echo
echo
echo “Enter password again”
echo -n “Password: ”
stty -echo
read PASS2
stty echo
echo
if [ “$PASS1” != “$PASS2” ]
then
echo passwords did not match
exit
fi
LIST=$1
echo “$LOGIN:$PASS1” >account.info
for X in `cat $LIST`
do
echo Performing Password Change for $LOGIN on $X
scp ./account.info $X: >/dev/null
ssh $X “cat account.info | sudo /usr/sbin/chpasswd” >/dev/null
ssh $X rm account.info
done
rm account.info
Leave a Reply
You must be logged in to post a comment.