Skip to content

Instantly share code, notes, and snippets.

@masayuki5160
Created September 14, 2013 08:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masayuki5160/6560196 to your computer and use it in GitHub Desktop.
Save masayuki5160/6560196 to your computer and use it in GitHub Desktop.
ログイン用のシェル
#!/bin/sh
USER="masayuki"
HOST="192.168.10.10"
PASS="pass"
expect -c "
set timeout 10
spawn ssh $USER@$HOST
expect \"Are you sure you want to continue connecting (yes/no)?\" {
send \"yes\n\"
expect \"${USER}@${HOST}'s password:\"
send \"${PASS}\n\"
} \"${USER}@${HOST}'s password:\" {
send \"${PASS}\n\"
}
interact
"
@masayuki5160
Copy link
Author

事前にこれだけすること
yum -y install expect

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