当前位置:网站首页>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
边栏推荐
- PCB defect detection based on OpenCV and image subtraction
- Saving images of different depths in opencv
- STM32——一线协议之DS18B20温度采样
- Druid监控统计数据源
- STM32 - DS18B20 temperature sampling of first-line protocol
- Introduction to webrtc concept -- an article on understanding source, track, sink and mediastream
- MCU firmware packaging Script Software
- An article explaining the publisher subscriber model and the observer model
- How to determine the progress bar loaded in the loading interface when opening the game
- Mouse over effect 9
猜你喜欢

【小程序项目开发-- 京东商城】uni-app之分类导航区域

The operation efficiency of the park is improved, and the application platform management of applet container technology is accelerated

php批量excel转word

Metadata in NFT

Optimal Transport系列1
![[applet project development -- JD mall] uni app commodity classification page (first)](/img/6c/5b92fc1f18d58e0fdf6f1896188fcd.png)
[applet project development -- JD mall] uni app commodity classification page (first)

记一次服务部署失败问题排查
![Install vcenter6.7 [vcsa6.7 (vCenter server appliance 6.7)]](/img/83/e3c9d8eda9d5351d4c54928d3b090b.png)
Install vcenter6.7 [vcsa6.7 (vCenter server appliance 6.7)]

How the network is connected: Chapter 2 (Part 2) packet receiving and sending operations between IP and Ethernet

【Qt】添加第三方库的知识补充
随机推荐
最新接口自动化面试题
Introduction and basic knowledge of machine learning
Here comes the share creators budding talent training program!
如何校验两个文件内容是否相同
Mnasnet learning notes
So easy 将程序部署到服务器
Catch 222222
鼠标悬停效果八
ipmitool下载地址和编译安装时可能出现的问题
JS to find duplicate elements in two arrays
Why are strings immutable in many programming languages? [repeated] - why are strings immutable in many programming languages? [duplicate]
Cloud native annual technology inventory is released! Ride the wind and waves at the right time
Introduction to webrtc concept -- an article on understanding source, track, sink and mediastream
Mouse over effect 9
Network address translation (NAT) technology
Lenovo x86 server restart management controller (xclarity controller) or TSM method
鼠标悬停效果十
【小程序项目开发 -- 京东商城】uni-app 商品分类页面(下)
单片机 MCU 固件打包脚本软件
实战 ELK 优雅管理服务器日志