ssh Authentication refused: bad ownership or modes

created at 06-04-2022 views: 7


When setting up ssh password-free login, it is found that some machine settings do not take effect. Some machines are normal.


Log in to the target machine and view the log information of sshd. The log information directory is, /var/log/secure

You will find log messages like the following.

Jul 22 14:20:33 v138020.go sshd[4917]: Authentication refused: bad ownership or modes for directory /home/xxxx


sshd requires the owner's directory and file permissions for security. If the permissions are incorrect, the password-free login of ssh will not take effect.

  • The user directory permissions are 755 or 700, but cannot be 77x.
  • .ssh directory permissions are generally 755 or 700.
  • and authorized_keys permissions are generally 644
  • rsa_id permission must be 600


Check directory permissions, and set permissions as required for those that do not meet the requirements.

created at:06-04-2022
edited at: 06-04-2022: