On my Mac, I can't use git (and consequently Heroku) because of incorrect file permissions. The root user can access them fine, but my user cannot, despite me owning it and it being in my home directory.

$ ls -al

shows that I own the file and only have read and write permissions:

drw-------    7 george  staff     238 27 Aug 16:53 .ssh

whilst having no ACLs.


$ chmod -R 0600 /Users/george/.ssh
chmod: /Users/george/.ssh/github_rsa: Permission denied
chmod: /Users/george/.ssh/github_rsa.pub: Permission denied
chmod: /Users/george/.ssh/id_rsa: Permission denied
chmod: /Users/george/.ssh/id_rsa.pub: Permission denied
chmod: /Users/george/.ssh/known_hosts: Permission denied
chmod: /Users/george/.ssh: Permission denied

I've tried every thing I could think of, chown, chmod and chmod -N (to remove any ACLs). But I still can't read or write them and nor can git.

Any solutions welcomed!


To access a folder like you want to access it you need the permission x (execute) for the directory.

So if you change the premissions with

chmod u+x .ssh

it should be possible to access your folder.

You can only change into a folder when you have the appropriate execute permission for it.

  • Thanks for the quick reply, but I still cannot access the directory nor change permissions on it.
    – galexite
    Sep 12 '14 at 11:31
  • Do "chmod 700 /Users/george/.ssh" first. If that is not allowed then something's going on with ACLs or such.
    – wurtel
    Sep 12 '14 at 12:34

I've managed to delete the SSH folder and regenerate keys. I don't know how the .ssh folder got in this way, but I can get back to using git now.

  • 1
    The "chmod -R 0600 /Users/george/.ssh" caused the execute permission to be removed from the directory, meaning you can't access the files in that directory (you can still read the directory to see its contents).
    – wurtel
    Sep 12 '14 at 12:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.