SSH authentication refused bad ownership or modes for file

SSH keys authentication scheme

So you created SSH keypair, installed public key on the server you want to connect to but, probably, made this not as described in this article: How To Set Up SSH Keys and now the server refuses your key and in /var/log/secure we can see message like this:

Authentication refused: bad ownership or modes for file /home/user/.ssh/authorized_keys

or

Authentication refused: bad ownership or modes for directory /home/user/.ssh

Correct .SSH directory permissions

The .ssh directory permissions should be 700 (drwx——).  The public key (.pub file) should be 644 (-rw-r–r–). The private key (id_rsa) on the client host, and the authorized_keys file on the server, should be 600 (-rw——-).

To fix .ssh directory and  authorized_keys permissions do the following:

Try to log in again.

Good luck!

Want me to do this for you? Drop me a line: itgalaxyzzz {at} gmail [point] com