Use the verify Ct script to complete ssh to perform password operations on two different computers

Source: Internet
Author: User
Of course, this is the simplest operation demonstration. you can also use shell scripts and reverse Ct scripts based on your actual tasks, which will greatly save the intermediate process time.

Use the verify Ct script to complete ssh to perform password operations on two different computers:

Server terminal: username,

Debian terminal: username: wr-physics, ip: xx. xxx

1. first on the server terminal:

$ Mkdirexpect-test

$ Cdexpect-test

2. create a debian terminal to receive the trusted Ct script

$ Viloop1andinput

#! /Usr/bin/CT

Setpassword ******

Spawnscp-rwr-physics@xx.xxx.xxx.xxx:/home/wr-physics/wr/Al/test ./

Country CT-nocase "password :"

Send "$ password \ r"

Expecteof

$ Andchmod + xloop1

3. create an audit Ct script to send test to debian terminal from the server terminal

#! /Usr/bin/CT

Setpassword841219

Spawnscp-rtestwr-physics@xx.xxx.xxx.xxx:/home/wr-physics/wr/Al/

Country CT-nocase "password :"

Send "$ password \ r"

Expecteof

$ Andchmod + xloop2

4. create a shell script for server terminal computing

$ Viloopandinput

#! /Bin/sh

./Loop1

Cdtest

Command

Cd ..

./Loop2

$ Andchmod + xloop

$./Loop

Of course, this is the simplest operation demonstration. you can also use shell scripts and reverse Ct scripts based on your actual tasks, which will greatly save the intermediate process time.

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.