ssh「権限が開きすぎています」質問する

ssh「権限が開きすぎています」質問する

ssh から次のエラーが発生します:

Permissions 0777 for '/Users/username/.ssh/id_rsa' are too open.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.

id_rsa ファイルにどのような権限を与える必要がありますか?

ベストアンサー1

キーはあなただけが読み取り/書き込み可能である必要があります。

chmod 600 ~/.ssh/id_rsa

あるいは、キーを自分だけが読み取り可能にすることもできます (これにより、書き込みアクセスもブロックされます)。

chmod 400 ~/.ssh/id_rsa

600ほとんどの場合、後で編集するためにファイルの権限を変更する必要がないため、これがより適切であると思われます。(詳細についてはコメントを参照してください)

マンページからの関連部分(man ssh

 ~/.ssh/id_rsa
         Contains the private key for authentication.  These files contain sensitive 
         data and should be readable by the user but not
         accessible by others (read/write/execute).  ssh will simply ignore a private 
         key file if it is              
         accessible by others.  It is possible to specify a
         passphrase when generating the key which will be used to encrypt the sensitive 
         part of this file using 3DES.

 ~/.ssh/identity.pub
 ~/.ssh/id_dsa.pub
 ~/.ssh/id_ecdsa.pub
 ~/.ssh/id_rsa.pub
         Contains the public key for authentication.  These files are not sensitive and 
         can (but need not) be readable by anyone.

おすすめ記事