If you are setting a server or your own machine with SSH key password-less, then you will likely get this error Authentication refused bad ownership or modes.
This happens for your own security, SSH is very picky when dealing with
~/.ssh and this is the right thing, people apart from yourself should not be able to move, read or edit your
To fix this issue all you have to do is set the right permission.
chmod go-w ~/ chmod 700 ~/.ssh chmod 600 ~/.ssh/authorized_keys
Now you should be able to authenticate just fine.