자동 로그인 서버 expect

7203 단어 expect
ssh179
 1 #! /usr/bin/expect                                                                                                 

 2 set timeout 60

 3 set host 172.20.106.179

 4 set name [lindex $argv 0]

 5 set password abc123

 6 spawn ssh $name@$host 

 7 expect {

 8     "(yes/no)?" {

 9         send "yes
" 10 expect "password" 11 send "$password
" 12 } 13 "password" { 14 send "$password
" 15 } 16 } 17 interact

ssh53
 1 #! /usr/bin/expect                                                                                                 

 2 set timeout 60

 3 set host 172.20.106.53

 4 set name [lindex $argv 0]

 5 set password abc123

 6 spawn ssh $name@$host 

 7 expect {

 8     "(yes/no)?" {

 9         send "yes
" 10 expect "password" 11 send "$password
" 12 } 13 "password" { 14 send "$password
" 15 } 16 } 17 interact

ssh143
 1 #! /usr/bin/expect                                                                                                 

 2 set timeout 60

 3 set host 172.20.106.143

 4 set name [lindex $argv 0]

 5 set password abc123

 6 spawn ssh $name@$host 

 7 expect {

 8     "(yes/no)?" {

 9         send "yes
" 10 expect "password" 11 send "$password
" 12 } 13 "password" { 14 send "$password
" 15 } 16 } 17 interact

좋은 웹페이지 즐겨찾기