Created
December 19, 2014 02:21
-
-
Save skatsuta/efa43bd77bded188672e to your computer and use it in GitHub Desktop.
Auto login script
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
#!/bin/sh | |
auto_ssh() { | |
HOST=$1 | |
ID=$2 | |
PASS=$3 | |
KEY=$4 | |
expect -c " | |
set timeout 10 | |
spawn ssh ${KEY} ${ID}@${HOST} | |
expect \"Are you sure you want to continue connecting (yes/no)?\" { | |
send \"yes\n\" | |
expect \"${ID}@${HOST}'s password:\" { | |
send \"${PASS}\n\" | |
} | |
} \"${ID}@${HOST}'s password:\" { | |
send \"${PASS}\n\" | |
} | |
interact | |
" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment