Shell script Remote Batch execution command

Source: Internet
Author: User

#! /usr/bin/expectset ip 10.91.96.                  ######    Network Segment Set time 30set username  root#### #for  {set ip 11} {$ip <=50} {incr ip} {           ######  is greater than or equal to 11 less than or equal to 50 if IP is regularly available. foreach ip {81 82 83 84 86 87 88 89 91 92 93  94 96 97 98 99} {                 ##### #IPspawn  ssh -p 6122 [email protected] $IP $ipexpect  {"(yes/no)?"  { send  "yes\r";  exp_continue } "Password:"  { send  "[email  protected]\r " }   ###### root Password        }expect   "*#" send  "CP&NBSP;/ETC/LOGIN.DEFS&NBsp;/etc/login.defs.bak\r "send " cp /etc/profile /etc/profile.bak\r "send " cp /etc/ Pam.d/common-password /etc/pam.d/common-password.bak\r "send " sed  -i -e  '/^PASS_ max_days/' d /etc/login.defs\r "send " sed  -i -e  '/^pass_min_days/' d /etc/ Login.defs\r "send " sed  -i -e  '/^pass_warn_age/' d /etc/login.defs\r "send " Cecho pass_max_days 90 >> /etc/login.defs\r "send " echo PASS_MIN_DAYS  5 >> /etc/login.defs\r "send " echo pass_warn_age 7 >> /etc/ Login.defs\r "send " secho pass_min_len 8 >> /etc/login.defs\r "send " Echo  tmout=300 >> /etc/profile\r "send " echo password            required        pam_cracklib.so  use_authtok minlen=8 ucredit=-1 lcredit=-1 dcredit=-1 ocredit=-1 >> /etc/pam.d/ Common-password\r "expect " *# "send " exit\r " }expect eof


This article is from the "BOM water Year _" blog, please be sure to keep this source http://timefiles.blog.51cto.com/8475652/1882130

Shell script Remote Batch execution command

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.