~/.ssh/configでssh接続
~/.ssh/config
を編集
# hogeサーバー Host hoge HostName xxx.xxx.xxx.xxx Port 22 User login-user-name IdentityFile ~/.ssh/keys/hoge.pem
パーミッションで下記のように怒られる場合は、keyファイルの権限を700
にする
$ ssh hoge @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: UNPROTECTED PRIVATE KEY FILE! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Permissions 0644 for '/Users/username/.ssh/keys/hoge.pem' are too open. It is required that your private key files are NOT accessible by others. This private key will be ignored. bad permissions: ignore key: /Users/username/.ssh/keys/hoge.pem Permission denied (publickey).
以上の設定で、
$ ssh hoge
で接続できます