Recentemente, importei minhas chaves para uma nova máquina (Mac) e esqueci de modificar as permissões para 600. Ao fazer isso, escrevi acidentalmente chown
em vez de chmod
. Estranhamente, isso corrigiu o problema de permissão, como pode ser visto aqui:
% git pull origin develop
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/Users/m/.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 "/Users/m/.ssh/id_rsa": bad permissions
git@<redacted>: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
%
% sudo chown 600 ~/.ssh/id_rsa
Password:
%
% ls -l ~/.ssh/id_rsa
-rw-r--r--@ 1 600 staff 1679 Mar 25 15:14 /Users/m/.ssh/id_rsa
%
% git pull origin develop
From <redacted>
* branch develop -> FETCH_HEAD
Already up to date.
%
% ssh <redacted>
The authenticity of host '<redacted> (<redacted>)' can't be established.
ECDSA key fingerprint is <redacted>.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '<redacted>' (ECDSA) to the list of known hosts.
Warning: your password will expire in 5 days
Last login: Fri Jul 27 19:51:32 2018 from <redacted>
-bash-4.2$
Por que esse é o caso?