ssh批量分发

ssh-******  -t(指明算法)  dsa|rsa

之后:

ssh批量分发

 

 

[[email protected] ~]$ ssh-copy-id -i .ssh/id_dsa.pub  -p 22 [email protected]  把公钥发到107上

 

ssh批量分发

 

ssh批量分发

 

分发简单脚本:

#!/bin/bash
if [ $# -ne 1 ]
then
   echo "Usage:/bin/sh $0 arg1"
exit 233
fi

for i in 7 8
        do
scp -P22 -rp $1  [email protected]192.168.0.10$i:~
done

          

 

 

ssh批量分发

 

 

分发hosts文件至多台机器:

ssh批量分发

(低版本的系统可能ssh远程执行命令 不能直接跟sudo,要加-t)

 

ssh批量分发