Symptoms
You may receive a Permission denied error when connecting to your server via SSH and the following error is logged to /var/log/secure:
Authentication refused: bad ownership or modes for directory /root/.ssh
Description
This error occurs when the file permissions or user/group ownership of the /root/.ssh directory are incorrect. The permissions of /root/.ssh should be 0700. The user and group ownership should both be root.
The following command can be used to confirm the current file permissions and ownership or /root/.ssh:
stat --printf 'USER: %U\nGROUP: %G\nPERMS: %a\n' /root/.ssh
Workaround
If the permissions of /root/.ssh are not 0700, you can run the following command to change the permissions to 0700:
chmod -v 0700 /root/.ssh
If the user or group are not root, you can run the following command to change the user and group to root:
chown -v root:root /root/.ssh
Comments
0 comments
Article is closed for comments.