Open2

sshコマンドで利用する秘密鍵に設定する権限

shuichishuichi
man 1 ssh
SSH(1)                     General Commands Manual                   SSH(1)

NAME
       ssh — OpenSSH remote login client

...(省略)

FILES

...(省略)

       ~/.ssh/
               This directory is the default location for all user-specific
               configuration and authentication information.  There  is  no
               general  requirement to keep the entire contents of this di‐
               rectory  secret,  but  the   recommended   permissions   are
               read/write/execute  for the user, and not accessible by oth‐
               ers.

...(省略)
shuichishuichi
  • 秘密鍵ユーザーには読み込み・書き込み・実行権限のいずれもOK
  • それ以外のユーザーには権限なし

ということで、自分にのみ読み取り権限をつければよいか。

chmod 400 ~/.ssh/some_private_key.pem

確認:

ls -l ~/.ssh/some_private_key.pem
# 出力例
# -r-------- 1 ubuntu ubuntu 1674 Nov 21 02:50 .ssh/some_private_key.pem