In Linux, you can use the dedicated CT script to automatically log on to a remote machine.

Source: Internet
Author: User

In Linux, you can use the dedicated CT script to automatically log on to a remote machine.

First, create an audit CT script ssh_audit CT. The file content is as follows:

#!/usr/bin/expect -fset hostname [lindex $argv 0]set user [lindex $argv 1]set passwd [lindex $argv 2]set timeout 30set force_conservative 1if {$force_conservative} {    set send_slow {128 .1}}spawn ssh $user@$hostname;expect {        "*continue connecting (yes/no)?" { send -s "yes\r"; exp_continue }        "*assword:" {                send -s "$passwd\r";        }}interact

Then define some command aliases, such:

alias h101='ssh_expect 192.168.0.101   'alias h102='ssh_expect 192.168.0.102   '    

These aliases can be written ~ /. Bashrc File

Then execute h101 to automatically log on to the host 192.168.0.101.

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.