加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Shell分发系统

发布时间:2020-12-15 20:00:58 所属栏目:安全 来源:网络整理
导读:rsync.expect #!/usr/bin/expectsetpasswd"123456"##建议用密钥,防止口令泄露sethost[lindex$argv0]setfile[lindex$argv1]spawnrsync-avR--files-from=$file/root@$host:/expect{"yes/no"{send"yesr"}"password:"{send"$passwdr"}}expecteof list.txt /tm

rsync.expect

#!/usr/bin/expect
setpasswd"123456"##建议用密钥,防止口令泄露
sethost[lindex$argv0]
setfile[lindex$argv1]
spawnrsync-avR--files-from=$file/root@$host:/
expect{
"yes/no"{send"yesr"}
"password:"{send"$passwdr"}
}
expecteof


list.txt

/tmp/1.txt
/usr/local/sbin/2.sh


ip.list

192.168.89.134
192.168.87.167


rsync.sh

#!/bin/bash
foripin`cat/tmp/ip.list`
do
echo$ip
./rsync.expect$ip/tmp/list.txt
done


除了文件的分发外,还可以批量执行命令。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读