当前位置:网站首页>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
边栏推荐
- Introduction and basic knowledge of machine learning
- Cloud native annual technology inventory is released! Ride the wind and waves at the right time
- 使用ipmitool配置X86服务器的BMC网络和用户信息
- So easy 将程序部署到服务器
- 【机器学习】向量化计算 -- 机器学习路上必经路
- Sampling Area Lights
- [applet project development -- JD mall] uni app commodity classification page (Part 2)
- xxl-job使用指南
- Share Creators萌芽人才培養計劃來了!
- A small document of JS method Encyclopedia
猜你喜欢
产业互联网中,「小」程序有「大」作为
Optimal transport Series 1
Record a service deployment failure troubleshooting
Share Creators萌芽人才培養計劃來了!
Introduction and basic knowledge of machine learning
MCU firmware packaging Script Software
【小程序项目开发-- 京东商城】uni-app之分类导航区域
[applet project development -- JD mall] uni app commodity classification page (Part 2)
Voici le programme de formation des talents de SHARE Creators!
lavaweb【初识后续问题的解决】
随机推荐
# 使用 KubeKey 搭建 Kubernetes/KubeSphere 环境的'心路(累)历程'
LeetCode_ Stack_ Difficulties_ 227. basic calculator (excluding multiplication and division)
Contrastive learning of Class-agnostic Activation Map for Weakly Supervised Object Localization and
LeetCode_栈_困难_227.基本计算器(不含乘除)
Borrowing constructor inheritance and composite inheritance
产业互联网中,「小」程序有「大」作为
PHP batch Excel to word
【小程序项目开发--京东商城】uni-app之自定义搜索组件(上)
【EXSI】主机间传输文件
Summary of problems encountered in debugging positioning and navigation
【小程序项目开发-- 京东商城】uni-app之分类导航区域
Introduction and basic knowledge of machine learning
mybati sql 语句打印
lavaweb【初识后续问题的解决】
Youmeng (a good helper for real-time monitoring of software exceptions: crash) access tutorial (the easiest tutorial for Xiaobai with some foundation)
单片机 MCU 固件打包脚本软件
UE4 rendering pipeline learning notes
servlet【初识】
Network address translation (NAT) technology
实战 ELK 优雅管理服务器日志