After long debugging, I found why I can not login to my MacOS machine with ssh:

Authentication refused: bad ownership or modes for directory /Users/myuser/projects

The problem is that I track my .ssh config directory in a git repo, and I link to it in my home directory. It seems that MacOS, as opposed to Linux, does check that all parent directories of the linked repo have strict permissions. And this even though the repo itself has the right permissions:

» ls -ld /home/myuser/projects/homedir/dotfiles/.ssh
drwx------ 2 myuser myuser 4096 Feb 14 07:47 /home/myuser/projects/homedir/dotfiles/.ssh

Is it possible to disable this checking in MacOS? I have a single directory structure which I rsync around to my machines, and having to change this because of this MacOs limitation is a pain.

  • 2
    If any of the higher level directories are writable by other users than your own, I think macos has the right approach here. For changes in those directories may well have the side effect of changing the target of the symlink. If they're merely readable and/or executable by other users, that seems unnecessarily strict. You might be able to set up a hook to copy the files into a proper ~/.ssh directory on a git pull, though? – Harald Hanche-Olsen Feb 14 '17 at 11:16
  • @HaraldHanche-Olsen probably you are right, that permissions should be only read for group, even for parent directories. The question is then why does linux do not behave the same way? – dangonfast Feb 14 '17 at 12:54
  • 2
    On Linux, the check is the same. It is in OpenSSH. – Jakuje Feb 14 '17 at 13:31

You must log in to answer this question.

Browse other questions tagged .