Just to clarify: the error I'm getting is not related with ssh files permissions. I'm not getting an error related with permissions.
I've the following ~/.ssh/config file
Host git-codecommit.*.amazonaws.com User APKAIxxxxxxxxxxxxxxx IdentityFile ~/.ssh/id_rsa
config and id_rsa files have the following permissions
-rw------- 1 jmsanzg jmsanzg 93 jun 24 16:23 config -rw------- 1 jmsanzg jmsanzg 1679 abr 26 2015 id_rsa -rw-r--r-- 1 jmsanzg jmsanzg 396 abr 26 2015 id_rsa.pub
.ssh directory has the following permissions
drwx------ 2 jmsanzg jmsanzg 4096 jun 24 16:23 .ssh
If I execute ssh forcing it to use the certificate and then it works
jmsanzg@jmsanz:~$ ssh -i ~/.ssh/id_rsa APKAIxxxxxxxxxxxxxxx@git-codecommit.us-east-2.amazonaws.com You have successfully authenticated over SSH. You can use Git to interact with AWS CodeCommit. Interactive shells are not supported.Connection to git-codecommit.us-east-2.amazonaws.com closed by remote host. Connection to git-codecommit.us-east-2.amazonaws.com closed.
But whenever I try to execute it directly trying to use the config file it fails
jmsanzg@jmsanz:~$ ssh git-codecommit.us-east-2.amazonaws.com Permission denied (publickey).
Also if I set the user, just making tries to find why it fails, well, it fails too
jmsanzg@jmsanz:~$ ssh APKAIxxxxxxxxxxxxxxx@git-codecommit.us-east-2.amazonaws.com Permission denied (publickey).
This is driving me crazy because it worked like a charm since 2015 and yesterday sudendly stopped working without making (I think so) any change. I've tried the -v parameter on both and I cannot see any specific difference. Just at the end, the command line offers the RSA public key
debug1: Authentications that can continue: publickey debug1: Offering RSA public key: /home/jmsanzg/.ssh/id_rsa debug1: Server accepts key: pkalg rsa-sha2-256 blen 279 debug1: Authentication succeeded (publickey).
while the other command line that should use the config file is not offering the file /home/jmsanzg/.ssh/id_rsa
debug1: Authentications that can continue: publickey debug1: No more authentication methods to try. Permission denied (publickey).
EDIT To make things more interesting. I've copied config, id_rsa and id_rsa.pub files to another computer. Gave the same permissions and...they work both ways, using config and with the full command line.
-vparameters, or three. Try also the
-Goption (if your SSH client is new enough) to check if the configuration is being read.