---
title: "使用SSH遇到Authentication Refused: Bad Ownership or Modes for Directory"
author: "xwv"
date: "2013-07-02T15:40:28Z"
tags: ["SSH"]
categories: ["操作系统"]
slug: "ssh-authentication-refused-bad-ownership-or-modes-for-directory"
draft: false
lastmod: "2013-07-02T15:40:28Z"
id: 1897479
url: "https://xwv.iteye.com/blog/1897479"
---

在使用SSH进行git的远程仓库操作时,远端服务器提示要求输入密码.这与之前的使用情况并不

相同.检查了服务器的ssh的日志文件/var/log/secure后,注意到类似下面的信息:

      Authentication refused: bad ownership or modes for directory /home/git/.ssh

 

      想来应该是文件夹读写权限的设置问题.在Google之后,找到下面这个web,与所遇问题是类似的:

      [SSH Authentication Refused: Bad Ownership or Modes for Directory](http://www.daveperrett.com/articles/2010/09/14/ssh-authentication-refused/)

      下面转贴来自其中的一段内容:

*SSH doesn’t like it if your home or ~/.ssh directories have group write permissions. Your home directory should be writable only by you, ~/.ssh should be 700, and authorized\_keys should be 600*

*You can also get around this by adding StrictModes off to your ssh\_config file, but I’d advise against it - fixing permissions is the way to go.*