IT Certificaions

Google Cloud Platform

Wednesday, June 4, 2014

Can not connect to git using ssh (Permissions 0644 for '/root/.ssh/id_rsa' are too open.

Permissions 0644 for '/root/.ssh/id_rsa' are too open.
It is required that your private key files are NOT accessible by others.

------------------------
root@media-Vostro-1540:~/.ssh# ssh -T git@github.com

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/root/.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: /root/.ssh/id_rsa
Permission denied (publickey).

Solution :
First check the permission on id_rsa directory

root@media-Vostro-1540:~/.ssh# ls -lrt
total 12
-rw-r--r-- 1 root root 2160 Jun  4 15:05 known_hosts
-rw-r--r-- 1 root root 1766 Jun  4 15:12 id_rsa
-rw-r--r-- 1 root root  415 Jun  4 15:12 id_rsa.pub

Change it to write only for root user
---------------------------------------------------

root@media-Vostro-1540:~/.ssh# chmod 700 id_rsa

root@media-Vostro-1540:~/.ssh# ls -lrt
total 12
-rw-r--r-- 1 root root 2160 Jun  4 15:05 known_hosts
-rwx------ 1 root root 1766 Jun  4 15:12 id_rsa
-rw-r--r-- 1 root root  415 Jun  4 15:12 id_rsa.pub
root@media-Vostro-1540:~/.ssh# ssh -T git@github.com