Windows – Setting up SSH/Git on Cygwin yields “Bad permissions on ~/.ssh/config”

cygwin;gitsshwindows

I'm attempting to setup Git with OpenSSH under Cygwin. I almost got everything setup. I have the agent and public key and all that.. but now I get this really weird error:

$ git pull -u origin master
Bad owner or permissions on /home/Jordan/.ssh/config
fatal: The remote end hung up unexpectedly

Googling it appears to be a permissions error(of course). One problem: the permissions look fine to me.

I've also tried doing a chmod 0600 ~/.ssh/config, but that didn't help. What I've tried doing:

Jordan@EarlzWindows8VM ~/dev/NonExceptional
$ chmod 0600 ~/.ssh/config 

Jordan@EarlzWindows8VM ~/dev/NonExceptional
$ stat ~/.ssh/config 
  File: `/home/Jordan/.ssh/config'
  Size: 47              Blocks: 1          IO Block: 65536  regular file
Device: 4ade2efdh/1256075005d   Inode: 1970324837237461  Links: 1
Access: (0660/-rw-rw----)  Uid: ( 1001/  Jordan)   Gid: (  513/    None)
Access: 2013-01-12 22:53:32.483072600 -0500
Modify: 2013-01-12 22:53:32.486074700 -0500
Change: 2013-01-12 23:27:33.077476800 -0500
 Birth: 2013-01-12 22:53:32.483072600 -0500

Notice that for whatever reason, the permissions still appear to be 0660. I don't understand why though. I've verified these permissions in Windows Explorer. Only I have access to the file, and when checking the "effective access", the group Users does not have access to the file.

How do I fix this error?

Also, some background: Windows 8 Enterprise. Joined to a domain(which always makes permissions fun). Cygwin is up to date

Best Answer

Don't forget the ACLs

Nothing worked for me until I stripped the file of ACLs and reset the permissions.

#remove ACLs
setfacl -b ~/.ssh/config

#reset permissions
chmod 0600 ~/.ssh/config

You can use getfacl to view the current ACL on a file.

getfacl ~/.ssh/config

Before I removed the ACLs (Broken):

# owner: Administrators
# group: None
user::rw-
group::---
group:Authenticated Users:rwx
group:SYSTEM:rwx
mask:rwx
other:---

After: (working)

# file: config
# owner: myusername
# group: None
user::rw-
group::---
other:---