Shell script Remote Batch execution command

Source: Internet
Author: User

#! /usr/bin/expectip_array = $ (cat /tmp/ip.txt) username = rootfor ip  in ${ip_array[*]} {                 ##### #IPspawn  ssh -p 6122 [email protected]$ $ipexpect  {"(yes/ NO)? "  { send  "yes\r";  exp_continue } "Password:"  { send  "[email  protected]\r " }   ###### root password    }expect " *# "send " cp  /etc/login.defs /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&nbSp 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/1882242

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.