当前位置:网站首页>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
边栏推荐
- [applet project development -- Jingdong Mall] classified navigation area of uni app
- Example of Huawei operator level router configuration | example of configuring optionc mode cross domain LDP VPLS
- Cloud native annual technology inventory is released! Ride the wind and waves at the right time
- 如果在小券商办理网上开户安全吗?我的资金会不会不安全?
- php批量excel转word
- VMware vSphere 6.7虚拟化云管理之12、VCSA6.7更新vCenter Server许可
- Mouse over effect II
- robots. Txt restrict search engine inclusion
- Introduction and basic knowledge of machine learning
- JS to find duplicate elements in two arrays
猜你喜欢

单片机 MCU 固件打包脚本软件

Restcloud ETL practice data row column conversion

【Qt】添加第三方库的知识补充

Chapitre 03 Bar _ Gestion des utilisateurs et des droits

Optimal Transport系列1
![[machine learning] vectorized computing -- a must on the way of machine learning](/img/3f/d672bb254f845ea705b3a0ca10ee19.png)
[machine learning] vectorized computing -- a must on the way of machine learning

In the industrial Internet, "small" programs have "big" effects

Xception learning notes

Dell server restart Idrac method
![Servlet [first introduction]](/img/2a/aff3b93e43550d30a33c1683210d3a.png)
Servlet [first introduction]
随机推荐
联想X86服务器重启管理控制器(XClarity Controller)或TSM的方法
# 使用 KubeKey 搭建 Kubernetes/KubeSphere 环境的'心路(累)历程'
鼠标悬停效果九
MCU firmware packaging Script Software
Redis分布式锁的8大坑
园区运营效率提升,小程序容器技术加速应用平台化管理
Evaluation of the entry-level models of 5 mainstream smart speakers: apple, Xiaomi, Huawei, tmall, Xiaodu, who is better?
[small program project development -- Jingdong Mall] the home page commodity floor of uni app
Metadata in NFT
Optimal transport Series 1
鼠标悬停效果六
[linear DP] longest common subsequence
Saving images of different depths in opencv
记一次服务部署失败问题排查
股票开户安全吗?上海股票开户步骤。
If a parent class defines a parameterless constructor, is it necessary to call super ()?
鼠标悬停效果一
【Qt】添加第三方库的知识补充
限流组件设计实战
How to open a stock account? Also, is it safe to open an account online?