クライアントにLinux環境(Cygwin)&OpenSSLがインストールされている前提
1.クライアントでキーペア作成
cd ~/.ssh/
ssh-keygen -t rsa -f hoge_rsa
scp ./hoge_rsa.pub myaws:~/.ssh/
※myawsは、.ssh/config で定義。
2.サーバで公開鍵の登録
cd ~
chmod 700 .ssh
cd .ssh
cat hoge_rsa.pub >> authorized_keys
chmod 600 authorized_keys
rm -fv hoge_rsa.pub
3.テスト
ssh -i ~/.ssh/hoge_rsa ec2-user@HOSTNAME
4.configに登録
vi ./ssh/config
Host myaws
HostName xxxx.xxxx.xxxx.xxxx
Port 22
IdentityFile ~/.ssh/hoge_rsa
User ec2-user
TCPKeepAlive yes
ServerAliveInterval 60
IdentitiesOnly yes
5.再度テスト
ssh myaws