Permissions on `~/.ssh` are correct, but you still get `Permission denied (publickey)` and the server log says `Authentication refused: bad ownership or modes for directory /home/deploy`.
IntermediateTroubleshootingSSH, sudo and authentication
Answer
Likely causes → The home directory itself is group- or world-writable (StrictModes yes checks every path component).
Diagnose →
sudo journalctl -u sshd | grep -i 'bad ownership'
namei -l /home/deploy/.ssh/authorized_keys
Fix → sudo chmod 755 /home/deploy (or 750), owned by the user.
Prevent → Don't chmod 777 home directories to "fix" sharing; use groups.
More on SSH, sudo and authentication
`ssh deploy@server01` fails with `deploy@server01: Permission denied (publickey).`BeginnerKey auth fails only on RHEL with SELinux enforcing; the server logs show nothing unusual about modes.IntermediateAfter upgrading the client to a new OpenSSH, connections to an old appliance fail with `no matching host key type found. Their offer: ssh-rsa,ssh-dss`.IntermediateA user's RSA key stopped working against a new server: the server log says `userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms`.IntermediateSSH login takes 20–30 seconds before the password or key prompt appears.IntermediateSSH fails immediately with `kex_exchange_identification: read: Connection reset by peer`.Advanced