38
36

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

SSH接続しようとしたら秘密鍵のパーミッションエラーがでた

Last updated at Posted at 2018-04-29

概要

新しくvagrant環境を作り、git push しようとしたら、なぜか秘密鍵がないといわれまして。。。
そこで、もともと使っていた環境のSSH鍵をコピーし、再実行しようとしたら、怒られた。

vagrant@vagrant:/vagrant/trunk-web$ git push origin now_branch
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0664 for '/home/vagrant/.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.
Load key "/home/vagrant/.ssh/id_rsa": bad permissions
Permission denied (publickey).
fatal: Could not read from remote repository.

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

どうやら鍵がオープンすぎたらしい。
まぁコピー&ペーストしただけだからね。

解決方法

鍵のパーミッションを0600にしてあげるといいらしい。

$ chmod 0600 ~/.ssh/id_rsa

これでもう1回git push したところ、きちんとできました\(^○^)/

38
36
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
38
36

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?