[Drupal] [Solved] WARNING: Unprotected private key file!

| | 2 min read

While cloning a new Drupal project in my local machine using ubuntu terminal, I got an error message like, "WARNING: UNPROTECTED PRIVATE KEY FILE!, Permissions 0664 for '/home/user/.ssh/id_rsa' are too open". I found a solution for this type of error like change the file permission of id_rsa file.

Actually, after joining to Zyxware, I got my first task as 'to add a responsive multi-level dropdown menu to Corporate Blue theme'. For this task, first I need to clone git repository of the project and I'm using the ubuntu terminal for cloning, but while cloning I got an error message and it looks like,


  user@zyxware-011:~/public_html$ git clone [email protected]:zi-dt-black-blog.git
  Cloning into 'zi-dt-black-blog'...
        WARNING: UNPROTECTED PRIVATE KEY FILE!       
  Permissions 0664 for '/home/user/.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: /home/user/.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. 

When I saw this message, I thought that my public key has some error or may be not added in the git configuration. So I emailed this error to my TL. So we start cloning again and again, delete the existing .ssh folder, recreation of .ssh folder etc. But we still can't clone the feature.

At that time we notice the error line "Permissions 0664 for '/home/user/.ssh/id_rsa' are too open". Then we understand that, there may be some file permission problem. And the private key must be private and here it is accessible to others to read, which is not satisfied. We can see the permissions for that file using the command 'ls -All /home/user/.ssh/id_rsa', and it will show the permission like' -rw-r--r--r '.

So, the solution for this is, make that file(id_rsa) readable or writable only for the owner with private key. While surfing web we got a snippet 'chmod 600 /home/user/.ssh/id_rsa' for making the file private.
After using this command my problem is solved.

Reference : http://www.thinkplexx.com/learn/howto/security/ssh/fix-permissions-are-…