Sometimes you want to ssh to other servers without input its password, then this script might be useful : )
First of all you need to create a file named "server_list" at /root/, like:
[root@lvs01 ~]# cat server_list
192.168.1.129 lvs01
192.168.1.130 lvs02
192.168.1.131 web01
192.168.1.132 web02
...
here is the script:
cd /root/.ssh/
echo "please keeping press enter :) "
ssh-keygen -t rsa
cat id_rsa.pub >> authorized_keys
echo "=============sync the authorized_keys file=============="
for i in `cat /root/server_list | grep -v "#" | awk '{print $1}'`; do
echo "please enter $i's password: "
scp /root/.ssh/authorized_keys root@$i:/root/.ssh/
done