ssh自動分發密匙指令碼樣板

來源:互聯網
上載者:User

標籤:cal   erro   enabled   hpa   wget   div   shp   pass   本地yum   

#!/bin/bashrom=/media/cdromdir=/etc/yum.repos.dUse=$1mima=$2function 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=localrepobasenurl=:///"$rom"gpgcheck=0enabled=1fof/usr/bin/yum -y clean all &>/dev/null/usr/bin/yum makecache &>/dev/null[ $? -eq 0 ] || echo "本地yum出錯"which "wget"rom=/media/cdromdir=/etc/yum.repos.dUse=$1mima=$2function 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=localrepobasenurl=:///"$rom"gpgcheck=0enabled=1fof/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=localrepobasenurl=:///"$rom"gpgcheck=0enabled=1fof/usr/bin/yum -y clean all &>/dev/null/usr/bin/yum makecache &>/dev/null[ $? -eq 0 ] || echo "本地yum出錯"which "wget"#!/bin/bashrom=/media/cdromdir=/etc/yum.repos.dUse=$1mima=$2function 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=localrepobasenurl=:///"$rom"gpgcheck=0enabled=1fof/usr/bin/yum -y clean all &>/dev/null/usr/bin/yum makecache &>/dev/null[ $? -eq 0 ] || echo "本地yum出錯"which "wget"[ $? -eq 0 ] || /usr/bin/yum -y install wget &>/dev/null[ $? -eq 0 ] || (/bin/echo "wget error" && exit)/usr/bin/wget http://mirrors.aliyun.com/repo/epel-6.repo[ $? -eq 0 ] || (/bin/echo "yun源出錯" && exit)/usr/bin/yum -y clean all &>/dev/null/usr/bin/yum makecache &>/dev/null[ $? -eq 0 ] || (/bin/echo "yun緩衝錯誤" && exit)/bin/echo "yum ok"}/bin/ping  -c 2 www.baidu.com &>/dev/null[ $? -eq 0 ] || (/bin/echo "沒網" && exit)which  "sshpass" &>/dev/null[ $? -eq 0 ] || /usr/bin/yum -y install sshpass &>/dev/nullif [ $? -ne 0 ] ;then yumj /usr/bin/yum -y install sshpass &>/dev/null || (echo "sshpass error" && exit)fi[ -d ~/.ssh ] || mkdir -p ~/.ssh ; chmod 700 ~./sshrm -rf ~/.ssh/id_*ssh-keygen -t dsa -f ~/.ssh/id_dsa -P "" &>/dev/nullfor i in 192.168.200.{1..245}do/bin/ping  -c 1 -i 0.1 $i &>/dev/nullif        [ $? -eq 0 ];then        sshpass -p $mima ssh-copy-id -i ~/.ssh/id_dsa.pub "-o StrictHostKeyChecking=no [email protected]$i"        echo "$i 密匙成功"fidone

 

ssh自動分發密匙指令碼樣板

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.