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 2016 for 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.131 ssh -l root 192.168.57.135 'ifconfig'