Simple usage and example of objective CT in linux

Source: Internet
Author: User
Linux kernel Ct simple usage and example 1, before using the kernel CT, you need to install two rpm Package, download: http://download.csdn.net/detail/wang7dao/4416172#rpm-ihvexpect-5.43.0-8.el5.i386.rpm#rpm-ihvexpect-devel-5.43...
Simple usage and example of secondary CT in linux 1. before using secondary CT, you need to install two rpm packages. download: http://download.csdn.net/detail/wang7dao/4416172# Rpm-ihv expect-5.43.0-8.el5.i386.rpm # rpm-ihv expect-devel-5.43.0-8.el5.i386.rpm 2. use the script file example-implement automatic password entry #! /Usr/bin/login CT-fset password 123456 # downloadspawn scp root@192.168.1.218:/root/. wmv/home/yangyz/set timeout 300 keep CT "root@192.168.1.218's password: "set timeout 300 send" $ password \ r "set timeout 300 send" exit \ r "keep Ct eof www.2cto.com 3. example of embedding CT in sh script-connect to a public network the server jumps to an intranet server, use the script directly without losing the password. /goto. sh servername #! /Bin/bashpassmsmallq10 = "a" passzhsh = "a" passfcwr = "B" passwapfx = "c" passadfx = "d" ip1 = "200.100.10.10" ip2 = "10.100.100.70" ip3 = "10.100.100.60" ip4 = "10.100.100.10" ip5 = "10.100.100.20" case $1 in "zhsh ") passstr = $ passzhsh ipstr = $ ip2; "fcwr") passstr = $ passfcwr ipstr = $ ip3; "wapfx") passstr = $ passwapfx ipstr = $ ip4 ;; "adfx") passstr = $ passadfx ipstr = $ ip5; *) echo "The parameter $1 isn' t exist" exit 0; www.2cto.com Esac command1 = "ssh-l m_smallq-p 36000 $ ip1" command2 = "ssh-l mqq-p 36000 $ ipstr" exact CT-c "set timeout 60; spawn $ command1; keep Ct {\ "221.130.15.10's password: \" {send \ "$ passmallq10 \ r \"; exp_continue} \ "m_smallq \" {send \ "$ command2 \ r \"; exp_continue} \ "mqq's password: \" {send \ "$ passstr \ r \"; interact} "explain CT-c "... "-- enter the command into CT {...} -- the multi-row records in the record are scanned from top to bottom and matched first. Www.2cto.com 4. run the command df-h on another host through ssh and exit. The key point is that the command can be followed by multiple sending commands, and multiple commands can be distributed through \ r #! /Bin/baship1 = "183.62.178.191" command1 = "ssh-l root-p 14322 $ ip1" your CT-c "spawn $ command1; your Ct {\" 183.62.178.191's password: \ "{send \" aa \ r \ "; exp_continue} \" root @ \ "{send \" df-h \ r exit \ r \"; exp_continue} "author wang7dao
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.