Friday, September 11, 2015

Shell Script to change the passwords of all users except root user in unix

#!/bin/ksh
##########################################################
# A Korn Shell Script to change all the passwords of users except root user
##########################################################
users =`cut -d":" -f1 /etc/passwd
for i in $users
do
if [$i != 'root'];
then
echo "please wait changing passwords from users $i";
echo "1234" | passwd --stdin $i
done
exit;
#######################################################
#Please correct if you find any error in the script
#######################################################


No comments:

Post a Comment