Ssh and scp key-free remote command execution: Keep CT, sshscp

Source: Internet
Author: User

Ssh and scp key-free remote command execution: Keep CT, sshscp

First install CT

# Yum-y install benchmark CT

Command Format

#./Verify ct ip comm # verify CT is an independent tool, so sh cannot be used for execution.

12345678910111213141516171819 #!/usr/bin/expect set timeout -1    # The default timeout value is 10 seconds. If you want to execute a long command, it is necessary to set the timeout value to never time out. set COMMADN1 [lindex $argv 0]    # Pass the parameter variable. The first parameter after the script is referenced here. set COMMADN2 [lindex $argv 1]    # Pass the parameter variable. The second parameter following the script is referenced here. spawn ssh -p 22 $COMMADN1 $COMMADN2    # Ssh can be changed to an scp command for remote copying without a key expect {         "yes/no" {send "yes\r";exp_continue}    # Enter yes automatically when querying yes/no         "password:" {send "123456\r"}        # Automatically enter the defined password 123456 when querying the password         } expect eof

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.