SSH設定
パスワード認証を不可にする
$ vim /etc/ssh/sshd_config
# Change to no to disable tunnelled clear text passwords
PasswordAuthentication no
$ /etc/init.d/sshd restert
作成したAMIを選択してLaunch Instanceボタンをクリック。
keypair.pemを作成する。
Security Groupを作成する。
アクセスしてみる。
ssh -i ec2-keypair.pem ubuntu@ec2-***-**-***-***.compute-1.amazonaws.com
ここで気にくわなかったので再度Instanceを作り直した。
再度作りなおしてアクセスすると
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
**:**:**:**:**:**:**:**:**:**:**
Please contact your system administrator
Add correct host key in /home/iida/.ssh/known_hosts to get rid of this message.
Offending key in /home/****/.ssh/known_hosts:12
RSA host key for ec2-***-**-***-***.compute-1.amazonaws.com has changed and you have requested strict checking.
Host key verification failed.
原因は何度もkeyを変えてるので最初に作ったkeyがローカルPCにキャッシュされてしまって新しいkeyと一致しなくなってしまっているようだ。
/.ssh/known_hosts
の12line目を消すとうまくいった。
ココを参考にした。
参考サイト