当前位置:网站首页>Best used trust automation script (shell)
Best used trust automation script (shell)
2022-07-01 03:03:00 【Avenue to Jane @everyday】
1, Create three files ,
2 father.txt Put the server that needs to establish trust relationship ip list , The format is as follows 
3 passwd.txt Is the login password of the server , All servers must have the same password , If it is different, it can be modified rsa.sh Script 
4 rsa.sh Script for establishing trust relationship
#!/bin/bash
#ssh-keygen -t rsa
basepath=$(cd `dirname $0`; pwd)
echo $basepath
father_file_name='father.txt'
# Generate the key
if [ ! -f ~/.ssh/id_rsa ] ; then
ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
fi
cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys
pw=`cat $basepath/passwd.txt`
op_flag=$2
# Update for each machine hosts Documents and public key information
for HOSTNAME in `cat ${basepath}/${father_file_name}| grep -v '127.0.0.1'| grep -v '::1'|awk '{print $1}'`
do
{
sleep 2
mycommand="ssh-copy-id -i /root/.ssh/id_rsa.pub [email protected]${HOSTNAME}"
expect -c "
spawn ${mycommand};
set timeout 60
expect {
\"password:\" {send \"${pw}\r\"; exp_continue}
\"connecting (yes/no)?\" {send \"yes\r\"; exp_continue}
}
"
sleep 2
}&
done
wait
边栏推荐
- An article explaining the publisher subscriber model and the observer model
- Huawei operator level router configuration example | configuration optionA mode cross domain LDP VPLS example
- PCB defect detection based on OpenCV and image subtraction
- 产业互联网中,「小」程序有「大」作为
- Use ipmitool to configure BMC network and user information of X86 server
- If a parent class defines a parameterless constructor, is it necessary to call super ()?
- Introduction to webrtc concept -- an article on understanding source, track, sink and mediastream
- 安装VCenter6.7【VCSA6.7(vCenter Server Appliance 6.7) 】
- VMware vSphere 6.7虚拟化云管理之12、VCSA6.7更新vCenter Server许可
- How to buy Hong Kong shares in China? What platform is safer?
猜你喜欢

Voici le programme de formation des talents de SHARE Creators!

MCU firmware packaging Script Software

Communication protocol -- Classification and characteristics Introduction

Druid监控统计数据源

STM32——一线协议之DS18B20温度采样

产业互联网中,「小」程序有「大」作为

园区运营效率提升,小程序容器技术加速应用平台化管理

Youmeng (a good helper for real-time monitoring of software exceptions: crash) access tutorial (the easiest tutorial for Xiaobai with some foundation)

记一次服务部署失败问题排查

基于Pytorch完整的训练一个神经网络并进行验证
随机推荐
Huawei operator level router configuration example | BGP VPLS configuration example
彻底解决Lost connection to MySQL server at ‘reading initial communication packet
【微信小程序开发】样式汇总
lavaweb【初识后续问题的解决】
鼠标悬停效果八
Here comes the share creators budding talent training program!
Catch 222222
Mysql知识点
VMware vSphere 6.7 virtualization cloud management 12. Vcsa6.7 update vCenter server license
鼠标悬停效果六
Mouse over effect VI
Sampling Area Lights
园区运营效率提升,小程序容器技术加速应用平台化管理
js 找出两个数组中的重复元素
Is it safe to open a stock account? Shanghai stock account opening procedures.
Huawei operator level router configuration example | configuration static VPLS example
使用ipmitool配置X86服务器的BMC网络和用户信息
Servlet [first introduction]
[small program project development -- Jingdong Mall] the home page commodity floor of uni app
robots.txt限制搜索引擎收录