Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- select server in `cat ~/bin/server_list`
- do
- expect -c "
- spawn ssh ユーザ名@$server
- expect {
- \"Are you sure you want to continue connecting (yes/no)?\" {
- send \"yes\r\"
- expect \"password:\"
- send \"パスワード\"
- } \"ユーザ名@$server's password:\" {
- send \"パスワード\"
- }
- }
- interact
- "
- done
- # 1. ssshとか名前つけて~/bin/ssshに保存。実行権限つけておく。~/binにpath通ってると楽。
- # 2. ~/bin/server_listに改行区切りでサーバを書いておく。
- # 3. sssh ってコマンド実行するとサーバ一覧がでて、数字で選択できる。自動PW入力でssh接続できる。
Add Comment
Please, Sign In to add comment