Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
9
Help us understand the problem. What are the problem?

More than 5 years have passed since last update.

@ysti

ssh設定メモ:鍵ファイルのパーミッション

望ましい設定

.ssh : 700
.ssh/id_rsa : 600

james$ chown 700 .ssh
james$ chown 600 .ssh/id_rsa
james$ ls -al .ssh
drwx------   6 james staff   204  5 12 17:50 .
-rw-r--r--   1 james staff   278  5 12 17:44 config
-rw-------   1 james staff  1676  5 12 17:46 id_rsa
-rw-r--r--   1 james staff   448  5 12 17:48 known_hosts

環境

Mac OSX Yosemite

いきさつ

Windowsで使っていたキーとconfigをコピーして使おうとしたらエラーが出て、git cloneが失敗。。。

$ git clone ssh://git@example.com/var/git/hello/helloworld.git
Cloning into 'helloworld'...
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/Users/james/.ssh/id_rsa' 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/james/.ssh/id_rsa
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

鍵ファイルのパーミッションが緩すぎるらしいです。
しっかりしてますね。

ソース:Permissions on private key in .ssh folder?

もっとちゃんとしたソースが欲しかったけど面倒臭かった。すみません。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
9
Help us understand the problem. What are the problem?