Google Authenticatorのあれ
oathtool入れてるの前提
適当な名前をつけてシェルをつくる
#!/bin/shTOTP=`oathtool --totp--base32 XXXXXXXXXXXXXXX`
expect -c"
set timeout 5
spawn ssh AAAAAAAAAAAAA
expect \"Verification code:\"
send \"${TOTP}\n\"
interact
"これでaliasも登録すればいっぱつ。やったぜ。
ちなみにAWSの2段階認証はaws-mfa入れてなんやかんやできます。やったぜ。
pip3 install aws-mfa
設定とかは割愛