Troubleshooting

Key-based SSH login for user alex fails, and the server falls back to a password prompt. The public key in ~/.ssh/authorized_keys is correct and the file mode is 0600. The authentication log shows "Authentication refused: bad ownership or modes for directory /home/alex," and the home directory is mode drwxrwxrwx. Which action BEST fixes the problem?

Show the answer

Correct answerA. Remove group and other write permission from /home/alex with chmod go-w

With StrictModes enabled, sshd rejects keys when the home directory is writable by group or others, so removing that write access fixes the cause. Disabling StrictModes also works but removes a protection and does not fix the permissions.