3

linux自动登录脚本 - willpower88 - BlogJava

 3 years ago
source link: http://www.blogjava.net/willpower88/archive/2021/01/18/435774.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
linux自动登录脚本 - willpower88 - BlogJava #!/usr/bin/expect
####################
set pass xxxx
set user yyyy
####################
spawn ssh -p 35000 -o StrictHostKeyChecking=no "${user}@xgrelay.xxxx.com"
expect {
  -re ".*Dkey.*" { gets stdin dkey; send "$dkey\r"; exp_continue}
  -re "Option>:"  { send "1\r" ;}
  -re "Password>:" { send "$pass\r" ; exp_continue }
  -re "password:" { send "$pass\r" ; exp_continue }
}

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK