用shell脚本批量分发公钥,实现用…
来源:互联网 发布:php trim 编辑:程序博客网 时间:2024/06/06 09:41
用shell脚本批量分发公钥(将所有),先创建密钥分发expetc脚本key.exp
再创建shell脚本,调用expetc
1.vim ip.txt
10.1.1.1
10.2.2.2
10.3.3.3
2.key.exp
vim key.exp
#!/usr/bin/expetc
set timeout 300
set password "redhat"
set ip [lindex $argv 0]
spawn ssh-copy-id root@$ip
expetc{
"yes/no"{
send "yes\r"
exp_continue
}
"password: "{
send"password\r"
exp_continue
}
eof;
}
再创建shell脚本,调用expetc
3.
vim distribute.exp
#!/bin/bash
./etc/init.d/functions
for i in 'cat /root/ip.txt';do
expetc /root/key.exp $i>/dev/null 2>&1
if[$? -eq 0];then
action"$i" /bin/true
else
action "$i"/bin/false
fi
done
阅读全文
0 0
- 用shell脚本批量分发公钥,实现用…
- 用shell脚本批量连续更改FreeBSD主机ip
- 用shell脚本批量修改目录下的文件名
- 用Perl脚本实现MS批量任务
- 批量解压shell脚本
- 批量压缩shell脚本
- shell批量互信脚本
- Shell 批量停起库脚本
- awk写shell分发脚本
- shell脚本_【分发系统】
- 批量给Linux服务器分发公钥
- mysql数据库批量插入数据shell脚本实现
- shell脚本中使用iconv实现批量文件转码
- 用exec函数族实现shell脚本
- 用shell脚本实现希尔排序
- shell脚本批量移动文件
- shell脚本批量添加用户
- shell脚本批量增加用户
- shell脚本批量添加用户
- shell脚本习题
- 设计模式之装饰模式
- rsync服务器搭建,实现自动化备份
- linux expect自动登录s…
- 用shell脚本批量分发公钥,实现用…
- 搭建nfs共享文件系统并用rsync+ino…
- RC4算法
- JavaScript中的数据类型
- “玲珑杯”ACM比赛 Round #18 A -- 计算几何你瞎暴力
- Kafka+Storm+HBase项目Demo(2)--Kafka环境搭建
- 复杂ListView实现
- Python:基础知识提要
- Hello,world!第一篇CSDN博客