Help Center/ Elastic Cloud Server/ Troubleshooting/ SSH Connection Issues/ What Do I Do If "Authentication refused: bad ownership or modes for directory /root" Is Displayed and I Can't Log In to an ECS Using SSH Key?
Updated on 2024-08-15 GMT+08:00

What Do I Do If "Authentication refused: bad ownership or modes for directory /root" Is Displayed and I Can't Log In to an ECS Using SSH Key?

Symptom

You cannot log in to an ECS using an SSH key, and the error message "Authentication refused: bad ownership or modes for directory /root" is displayed.

Figure 1 Failure of logging in to the ECS using an SSH key

Probable Causes

Error information in logs indicates that the permission of the /root directory is incorrect. Check the permission, owner, and owner group of the /root directory, .ssh in the /root directory, and authorized_keys in the .ssh directory.

Solution

Change the owner, owner group, and permission of the /root directory to recover the SSH.