Use the expect tool to automatically interact with passwords remote other hosts install httpd software

Source: Internet
Author: User
Use the expect tool to automatically interact with passwords remote other hosts install httpd software
#!/bin/bash
#删除 ~/.ssh/known_hosts, SSH remote any host will ask whether to confirm that you want to connect to the host
RM-RF ~/.ssh/known_hosts
Expect <<eof
Spawn SSH
192.168.4.254
Expect "yes/no"
{send "yes\r"}
#根据自己的实际情况将密码修改为真实的密码子串
Expect "password" {send "password \ r"}
Expect "#" {send "Yum-y install httpd\r"}
Expect "#" {Send "exit\r"}
Eof

Use the expect tool to automatically interact with passwords remote other hosts install httpd software

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.