当前位置:网站首页>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
边栏推荐
- Dart training and sphygmomanometer inflation pump power control DPC
- Magnetic manometer and measurement of foreign coins
- Voici le programme de formation des talents de SHARE Creators!
- Classic programming problem: finding the number of daffodils
- Contrastive learning of Class-agnostic Activation Map for Weakly Supervised Object Localization and
- Mouse over effect 7
- 鼠标悬停效果二
- Druid监控统计数据源
- 鼠标悬停效果三
- lavaweb【初识后续问题的解决】
猜你喜欢
![[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)

第03章_用户与权限管理

lavaweb【初识后续问题的解决】

kubernetes资源对象介绍及常用命令(二)

Introduction to kubernetes resource objects and common commands (II)

VMware vSphere 6.7 virtualization cloud management 12. Vcsa6.7 update vCenter server license

Redis高效点赞与取消功能

几行事务代码,让我赔了16万

Optimal transport Series 1

Nacos configuration center tutorial
随机推荐
How to buy Hong Kong shares in China? What platform is safer?
Use ipmitool to configure BMC network and user information of X86 server
如果在小券商办理网上开户安全吗?我的资金会不会不安全?
Add / delete / modify query summary insert/create/put/add/save/post, delete/drop/remove, update/modify/change, select/get/list/find
在国内如何买港股的股?用什么平台安全一些?
Dart training and sphygmomanometer inflation pump power control DPC
Example of Huawei operator level router configuration | example of configuring optionc mode cross domain LDP VPLS
最好用的信任关系自动化脚本(shell)
【小程序项目开发-- 京东商城】uni-app之分类导航区域
Redis高效点赞与取消功能
Optimal Transport系列1
Ipmitool download address and possible problems during compilation and installation
Chapitre 03 Bar _ Gestion des utilisateurs et des droits
If a parent class defines a parameterless constructor, is it necessary to call super ()?
Redis分布式锁的8大坑
访问url 404 的错误
【小程序项目开发 -- 京东商城】uni-app 商品分类页面(上)
Mouse over effect 9
STM32 - DS18B20 temperature sampling of first-line protocol
Résumé des styles de développement d'applets Wechat