Chinaunix首页 | 论坛 | 博客
  • 博客访问: 466279
  • 博文数量: 279
  • 博客积分: 4467
  • 博客等级: 上校
  • 技术积分: 2830
  • 用 户 组: 普通用户
  • 注册时间: 2007-04-03 14:43
文章分类

全部博文(279)

文章存档

2013年(1)

2012年(39)

2011年(35)

2009年(29)

2008年(131)

2007年(44)

分类:

2008-07-16 15:20:16

用法:expect autossh 192.168.67.251
set username root
set password 123sh
if { $argc != 1 } {
        puts "usage autossh "
                exit 0;
}
set sshkey 1
spawn ssh -t $username@[lindex $argv 0]
       expect  "*(Yes/no)*"  
       send "yes\r"
       set sshkey 1
       expect "*Password:*"  
       send "$password\r"
       set sshkey 0
       expect   eof  
       puts "eof"
        if {$sshkey != 1} {
        expect "*Password*"
       { send "$password\r" }
}
 
 
阅读(294) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~