Skip to content

Instantly share code, notes, and snippets.

@border
Last active January 18, 2018 03:39
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save border/7559905 to your computer and use it in GitHub Desktop.
Save border/7559905 to your computer and use it in GitHub Desktop.
- 贵厂的 ssh 自动登录脚本 dev.sh - smb auto mount scipt for mac: mount.sh
#!/usr/bin/expect
#
# Auto Login script Relay And Dev Server For XXX
#
set tokenprepass "Token PIN"
set relayhost "OOXX@xxx.com"
set server "OOXX@SERVER_HOST"
set password "HOST_PASSWD"
# Server Echo ON/OFF
log_user 0
spawn ssh $relayhost
sleep 1
expect {
"Enter PASSCODE:" or "Password:" {
send_user "Please Input SecurID:"
expect_user {
-re (.*)\n {
send "$tokenprepass$expect_out(1,string)\n"
}
}
exp_continue
}
sleep 1
"bash-xxx-ssl*" {}
}
sleep 1
send "ssh $server\r"
expect "*password:"
send "$password\n"
sleep 1
interact
#!/usr/bin/expect
#
# smb auto mount scipt for mac
#
set mountpath "/data/tmp"
set server "//USERNAME@dev.xxxx.com/USERNAME"
set password "PASS_WORD"
# Server Echo ON/OFF
log_user 1
spawn mount_smbfs $server $mountpath
sleep 1
expect "Password*"
send "$password\n"
sleep 1
interact
@codeskyblue
Copy link

nice

@blueshen
Copy link

blueshen commented Jun 3, 2014

good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment