6

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

2
  • Does it make a difference to move the config file to config-old and then create a new config file with the right permissions?
    – Heptite
    Jan 13, 2013 at 4:58
  • @Heptite no it doesn;t
    – Earlz
    Jan 13, 2013 at 16:07

8 Answers 8

16

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:---
2
  • 1
    This is the only solution that worked for me after I recently upgraded to the latest cygwin. ssh worked fine before the upgrade, but not after. Running on windows 7.
    – gdw2
    Feb 18, 2015 at 16:37
  • This requires cygwin 1.7.34-6
    – ClintM
    Feb 20, 2015 at 22:18
7

Iv'e found that this always fixes it:

chown Username:Users ~/.ssh/config
chmod go-rw ~/.ssh/config
1
  • This solution worked for me with the same issue.
    – firefusion
    Apr 8, 2013 at 14:25
4

The problem ended up being that the file was owned by group "None". I changed the group to "Users" and then I could freely change the permissions

I figured this out from this related question

2

This solution helped me:

cd ~/.ssh
chmod 600 *
1

My cygwin64 on win7 running as admin, the chmod/chown/setacl/icacls/copyacls/ didn't help; only this worked: ssh -F ~/.ssh/config ...

0

These commands should work:

chown $USER ~/.ssh/config
chmod 644 ~/.ssh/config

Prefix with sudo if the files are owned by different user.

If more files are affected, replace config with *.

In man ssh we can read:

Because of the potential for abuse, this file must have strict permissions: read/write for the user, and not writable by others. It may be group-writable provided that the group in question contains only the user.

0

This one worked for windows from the windows file properties 'Owner' tab add required USER as owner cd to the location where config file present then ssh to host

1
  • I'm not sure if this is an answer and if it is if it just duplicates existing answers. Please clarify what you're trying to say but also reading existing answers to see if they already say what you're trying to say.
    – blm
    Jan 19, 2016 at 20:43
-2

Your configuration file is writable for the group, and SSH doesn't like that. Do a

chmod go-rw ~/.ssh/config

1
  • 1
    The question shows that he tried that, and the mode did not change.
    – Heptite
    Jan 15, 2013 at 19:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .