在/usr/local/bin 目录下
#!/bin/bashuser=`whoami`
passwd=000000#yum install -y sshpass expectfor((current=102; current<=104; current++));dofor((host=102; host<=104; host++));dosshpass -p $passwd ssh -q -o StrictHostKeyChecking=no $user@hadoop$current expect << EOFspawn ssh-copy-id ${user}@hadoop${host}expect {"yes/no" {send "yes\r";exp_continue}"password" {send "$passwd\r"}}expect eof
EOFdone
done