Fix permissions of .ssh and authorized_keys
authentication refused bad ownership or modes | ssh key ignored permissions | correct permissions for .ssh folder | chmod | authorized-keys | permissionsCaution: This command changes the system. Understand what it does before you run it.
chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keysSets the ~/.ssh directory to 700 and authorized_keys to 600. With the default setting StrictModes yes, sshd refuses keys if these files are writable by others. The journal then shows a message like Authentication refused: bad ownership or modes.
Note: The home directory itself must not be writable by group or others either. The command must run as the affected user so that ~ points to the right directory.
Also searched as
- authentication refused bad ownership or modes
- ssh key ignored permissions
- correct permissions for .ssh folder