cat host 192.168.1.2 192.168.1.3
./batch_ssh.py -f host -u root -c id Password: #输入密码不显示 [Info] login in process [Info] exec_cmd 192.168.1.2: uid=0(root) gid=0(root) groups=0(root) 192.168.1.3: uid=0(root) gid=0(root) groups=0(root)
ssh/blob/0.0.2/README.md#保持回话方式)保持回话方式
./batch_ssh.py -u root -f host -mode=shell default: Host:[192.168.1.2, 192.168.1.3] User:root Passwd:None change host command add_host host change user command input user user chage passwd command input passwd view infomaintion use command show Cortrol # input passwd Password: #输入密码不显示 Cortrol # connect [Info] login in process Cortrol #cmd * id #对所以主机进行控制 192.168.1.2: uid=0(root) gid=0(root) groups=0(root) 192.168.1.3: uid=0(root) gid=0(root) groups=0(root) Cortrol #cmd 192.168.1.2 id #对单独一台机器控制 192.168.1.2: uid=0(root) gid=0(root) groups=0(root) Cortrol #scp * put /tmp/aa /tmp/test #把本地文件上传到所有主机上 把* 替换成需要传送的主机就针对一台主机了 192.168.1.2: [Info] Put transfer files successfully,Romtepath:/tmp/test 192.168.1.3: [Info] Put transfer files successfully,Romtepath:/tmp/test <br
ssh/blob/0.0.2/README.md#多台主机执行命令)多台主机执行命令
./batch_ssh.py -u root -H “192.168.1.2 192.168.1.3” -c ‘id’ Password: #输入密码不显示 192.168.1.2: uid=0(root) gid=0(root) groups=0(root) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 192.168.1.3 uid=0(root) gid=0(root) groups=0(root)
-H 为主机