1 服务端:
ssh-keygen -t rsa
ssh-copy-id -i /root/.ssh/id_rsa.pub 192.168.57.135
[root@192 sh]# more rsa.sh #!/bin/sh#by authors chy 2016for i in $(cat test.txt)do ssh-copy-id -i /root/.ssh/id_rsa.pub $i echo $i"设置密码登录成功"done注:可以将IP写在test.txt文件中
2 for循环批量执行免密钥配置如上
3 ssh使用
ssh -l root 192.168.57.131ssh -l root 192.168.57.135 'ifconfig'