Batch deployment of machine execution command templates without public keys

Source: Internet
Author: User
Run the "www.2cto.com" script to copy the ip address of the master control machine to more than two machines (IP: 172.16.1.187 and 172.16.1.188) without using the public key: 172.16.1.199 directory/liang/ceshi. sh script (if there are more objective requirements here...
Run the "www.2cto.com" script to copy the ip address of the master control machine to more than two machines (IP: 172.16.1.187 and 172.16.1.188) without using the public key: 172.16.1.199 directory/liang/ceshi. sh script (if you have more requirements, follow these steps to expand it !) You can run the following script on the master control machine IP address: 172.16.1.199! Method 1: (continuous ip) vim bushu. sh #! /Usr/bin/empty CT-ffor {set I 187} {$ I <= 208} {incr I} {spawn ssh-l root 172.16.1. $ ishortct "* password:" sleep 1 send "123456 \ r" ### you can continue to extract keywords! Keep CT "root" send "scp root@172.16.1.199:/liang/ceshi. sh/liang/\ r" # Here is the command operation to be executed in batches! More operations can be similar and written! ### Note that if you connect to IoT platform for the first time, the system may prompt yes/no! If this is the first time, you have to add the following two lines: # Your CT "yes" # send "yes \ r" your CT "pasword: "send" 123456 \ r "wrong CT eof} Method 2: (discontinuous ip address) the above can be written as follows :#! /Usr/bin/login CT-fforeach ip {172.16.1.187172.16.1.188} {spawn ssh-l root $ ipshortct "* password: "sleep 1 send" 123456 \ r "### you can continue to extract keywords! Keep CT "root" send "scp root@172.16.1.199:/liang/ceshi. sh/liang/\ r" # Here is the command operation to be executed in batches! More operations can be similar and written! ### Note that if you connect to IoT platform for the first time, the prompt "yes/notecct" pasword: "send" 123456 \ r "wrong CT eof} may be displayed}
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.