Password reset script

Hi all,

I am using an command which reset the password for the user, its working fine on Solaris boxes but sometimes the samw was not happening on some of linux boxes.

/bin/echo username | passwd --stdin username 

I am new to unix and shell scripting,so it would be very helpful for me if someone could explain the above commnad and why it doesnt working on some linux boxes.

i have another query

how to use

awk '{print $3}'

syntax inside the for loop
for eg :

 
for i in `cat server_list`
do
ssh $i '
echo hi
grep -i dba /etc/passwd | awk -f: '{print $5}' 
'
done 

i know it wont work coz of the ' (single colon) , so how can we eliminate that to make it work.

use the below

rsh nodename/IP "grep -i dba /etc/passwd | awk -F':' '{print $5}';"