Last active
January 18, 2018 03:39
-
-
Save border/7559905 to your computer and use it in GitHub Desktop.
- 贵厂的 ssh 自动登录脚本 dev.sh - smb auto mount scipt for mac: mount.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/expect | |
# | |
# Auto Login script Relay And Dev Server For XXX | |
# | |
set tokenprepass "Token PIN" | |
set relayhost "[email protected]" | |
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/expect | |
# | |
# smb auto mount scipt for mac | |
# | |
set mountpath "/data/tmp" | |
set server "//[email protected]/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nice