ssh自动分发密匙脚本样板
#!/bin/bash
rom=/media/cdrom
dir=/etc/yum.repos.d
Use=$
mima=$
function yumj(){
[ -d "$rom" ] || mkdir -p "$rom"
/bin/umount /dev/sr0
/bin/mount /devsro0 $rom
[ -d "$dir" ] || mkdir -p "$dir"
cd "$dir" &&\
mv * /tmp/
/bin/cat > /etc/yum.repos.d/local.repo << fof
[local]
name=localrepo
basenurl=:///"$rom"
gpgcheck=
enabled=
fof
/usr/bin/yum -y clean all &>/dev/null
/usr/bin/yum makecache &>/dev/null
[ $? -eq ] || echo "本地yum出错"
which "wget"
rom=/media/cdrom
dir=/etc/yum.repos.d
Use=$
mima=$
function yumj(){
[ -d "$rom" ] || mkdir -p "$rom"
/bin/umount /dev/sr0
/bin/mount /devsro0 $rom
[ -d "$dir" ] || mkdir -p "$dir"
cd "$dir" &&\
mv * /tmp/
/bin/cat > /etc/yum.repos.d/local.repo << fof
[local]
name=localrepo
basenurl=:///"$rom"
gpgcheck=
enabled=
fof
/usr/bin/yum -y clean all &>/dev/null
/usr/bin/yum makecache &>/dev/null
[ -d "$rom" ] || mkdir -p "$rom"
/bin/umount /dev/sr0
/bin/mount /devsro0 $rom
[ -d "$dir" ] || mkdir -p "$dir"
cd "$dir" &&\
mv * /tmp/
/bin/cat > /etc/yum.repos.d/local.repo << fof
[local]
name=localrepo
basenurl=:///"$rom"
gpgcheck=
enabled=
fof
/usr/bin/yum -y clean all &>/dev/null
/usr/bin/yum makecache &>/dev/null
[ $? -eq ] || echo "本地yum出错"
which "wget"
#!/bin/bash
rom=/media/cdrom
dir=/etc/yum.repos.d
Use=$
mima=$
function yumj(){
[ -d "$rom" ] || mkdir -p "$rom"
/bin/umount /dev/sr0
/bin/mount /devsro0 $rom
[ -d "$dir" ] || mkdir -p "$dir"
cd "$dir" &&\
mv * /tmp/
/bin/cat > /etc/yum.repos.d/local.repo << fof
[local]
name=localrepo
basenurl=:///"$rom"
gpgcheck=
enabled=
fof
/usr/bin/yum -y clean all &>/dev/null
/usr/bin/yum makecache &>/dev/null
[ $? -eq ] || echo "本地yum出错"
which "wget"
[ $? -eq ] || /usr/bin/yum -y install wget &>/dev/null
[ $? -eq ] || (/bin/echo "wget error" && exit)
/usr/bin/wget http://mirrors.aliyun.com/repo/epel-6.repo
[ $? -eq ] || (/bin/echo "yun源出错" && exit)
/usr/bin/yum -y clean all &>/dev/null
/usr/bin/yum makecache &>/dev/null
[ $? -eq ] || (/bin/echo "yun缓存错误" && exit)
/bin/echo "yum ok"
} /bin/ping -c www.baidu.com &>/dev/null
[ $? -eq ] || (/bin/echo "没网" && exit)
which "sshpass" &>/dev/null
[ $? -eq ] || /usr/bin/yum -y install sshpass &>/dev/null
if [ $? -ne ] ;then
yumj
/usr/bin/yum -y install sshpass &>/dev/null || (echo "sshpass error" && exit)
fi
[ -d ~/.ssh ] || mkdir -p ~/.ssh ; chmod ~./ssh
rm -rf ~/.ssh/id_*
ssh-keygen -t dsa -f ~/.ssh/id_dsa -P "" &>/dev/null
for i in 192.168..{..}
do
/bin/ping -c -i 0.1 $i &>/dev/null
if
[ $? -eq ];then
sshpass -p $mima ssh-copy-id -i ~/.ssh/id_dsa.pub "-o StrictHostKeyChecking=no $Use@$i"
echo "$i 密匙成功"
fi
done
ssh自动分发密匙脚本样板的更多相关文章
- 【SSH项目实战三】脚本密钥的批量分发与执行
[SSH项目实战]脚本密钥的批量分发与执行 标签(空格分隔): Linux服务搭建-陈思齐 ---本教学笔记是本人学习和工作生涯中的摘记整理而成,此为初稿(尚有诸多不完善之处),为原创作品,允许转载, ...
- ssh key一键自动化生成公钥私钥,并自动分发上百服务器免密码交互
题记:由于工作需要管理大量服务器,所以需要配公钥实现免密登录. ssh批量分发可以一键执行这个操作,但是使用ssh分发服务还需要对各个服务器进行.ssh/id_dsa.pub公钥上传,密码验证.所以需 ...
- 多节点ssh免密匙登录
1,在所有节点上,使用yourname用户名执行: ssh-keygen -t dsa -P '' -f /home/yourname/.ssh/id_dsa 2,在node1的/home/yourn ...
- Centos 解决SSH 免密码登录 以及Crontab制作定时SSH自动登录和关闭的脚本
一.SSH免密码登录 假设要登录的机器为192.168.1.100,当前登录的机器为192.168.1.101. 首先在101的机器上生成密钥(如果已经生成可以跳过): $ ssh-keygen -t ...
- 实现liunx之间无密码访问——ssh密匙
环境描述 两台linux服务器 172.16.1.22[client],172.16.1.33[server],想要实现client服务器ssh无密码访问server服务器. 使用技术 linux 的 ...
- ssh密匙互信操作【原创】
1.简便ssh密匙信任方法 只在一台服务器上创建ssh-keygen [root@SMSJKSRVBJ02 ~]# ssh-keygen Generating public/private rsa k ...
- [转] windows 上用程序putty使用 ssh自动登录Linux(Ubuntu)
需求: 在Win7电脑上使用putty(一种ssh客户端)连接Ubuntu 工具: puttygen.exe 和 putty.exe 第一步:生成密匙 运行puttygen.exe,选择需要的密匙类型 ...
- (转)SSH批量分发管理&非交互式expect
目录 1 SSH批量分发管理 1.1 测试环境 1.2 批量管理步骤 1.3 批量分发管理实例 1.3.1 利用sudo提权来实现没有权限的用户拷贝 1.3.2 利用sudo提权开发管理脚本 1.3. ...
- expect实现自动分发密钥、网站度量术语
1.优化ssh命令 sed -ir '13 iPort 52113\nPermitRootLogin no\nPermitEmptyPasswords no\n UseDNS no\nGSSAPIAu ...
随机推荐
- 分布式系统 SOA与中间件
在分布式系统中,有一个基础的理论 CAP,Consistency一致性 Availability可用性 Partition Tolerance分区容忍性,任何一个系统都不可能同时满足这三个条件(高富帅 ...
- centos升级vim
vim7爆出严重安全漏洞,升级到vim8,过程如下: yum remove vim -y yum install ncurses-devel -y 如果失败,提示unknown host apt.sw ...
- netty11---管道
客户端: package com.server; import java.net.Socket; public class Client { public static void main(Strin ...
- iis原理介绍
它是一个程序,负责对网站的内容进行管理,以及对客户的请求(就是Http请求)做出反应.当用户对一个页面提出请求时,IIS做如下反应(忽略权限):1.把对方请求的虚拟路径转换成物理路径2.根据物理路径搜 ...
- SQL学习笔记之B+树的几点总结
本文主要以列表形式将B+树的特点以及注意点等列出来,主要参考<算法导论>.维基百科.各大博客的内容,结合自己的理解写的,如内容有不当之处,请各位雅正. 0x00 前言 B树是为磁盘或其他直 ...
- openssl 编译
不要费事编译了,直接下载吧! https://www.npcglib.org/~stathis/blog/precompiled-openssl/ 下载 openssl https://www.ope ...
- 内核启动时在挂载ubi文件系统时提示UBIFS error (ubi0:0 pid 1): ubifs_read_superblock: min. I/O unit mismatch
一.背景 1.1 笔者机器的内核错误信息如下: UBIFS error (ubi0:0 pid 1): ubifs_read_superblock: min. I/O unit mismatch: 2 ...
- Flutter中集成Font Awesome
1.添加引用 在 pubspec.yaml文件中,加入 font awesome的引用 dependencies: flutter: sdk: flutter # The following adds ...
- TeeChart.Direct2D.dll的使用
这个dll本身依赖于第三方的控件,SlimDX ,可以从 http://slimdx.org/ 下载. .net4.0的版本区分x86和x64 帧数的概念 我们通常说帧数,简单地说,就是在1秒钟时间 ...
- 【ACM】求高精度幂
题目来源:http://poj.org/problem?id=1001&lang=zh-CN 求高精度幂 Time Limit: 500MS Memory Limit: 10000K To ...