Sunday 23 September 2018

How to fix Authentication refused: bad ownership or modes for directory



This is common issue faced while configuring public-key authentication for other users. Incorrect permission on $HOME/.ssh/ directory and $HOME/.ssh/authorized_keys is root which cause permission denied.

Run the following to change ownership and permission:

[root@linuxcnf ~]# chown username:username $HOME/.ssh
[root@linuxcnf ~]# chmod 700 $HOME/.ssh
[root@linuxcnf ~]# chown username:username $HOME/.ssh/authorized_keys
[root@linuxcnf ~]# chmod 600 $HOME/.ssh/authorized_keys

Now the problem should be fixed.

No comments:

Post a Comment