Fixing Authentication refused: bad ownership or modes for directory
If you get this error in /var/log/secure when trying to setup public key authentication (auto-login), the problem is related to permissions on your home directory or your ~/.ssh directory.
The user home directory cannot be group writeable, and there are specific permissions required in the .ssh directory as well.
Perform the following commands on the user account you are trying to setup:
chmod go-w ~ chmod 700 ~/.ssh chmod 600 ~/.ssh/authorized_keys