sshd: may ~/.ssh directory be symlinked

2

All the home directory dotfiles are symlinked into a repository, including the .ssh/. ssh seems to work fine, but I'm unable to connect to my server, if it is using the same setup.

Tried changing the auth_keys config in sshd_config to

#AuthorizedKeysFile %h/.ssh/authorized_keys
AuthorizedKeysFile  /data/progs/deps/homesick/repos/dotfiles/ssh/authorized_keys

but no-go:

Permission denied (publickey).

If I copy the whole dir to ~/.ssh, everything's back ok (this excluding all the permission issues et al.)

Does sshd allow symlinking the whole .ssh dir?

laur

Posted 2015-09-21T17:55:19.247

Reputation: 193

Are you keeping the same permissions in the new location for that file? – nKn – 2015-09-21T17:59:39.430

Yes, everything's the same. – laur – 2015-09-21T18:04:16.560

And are you able to cd /data/progs/deps/homesick/repos/dotfiles/ssh/ with the user you are doing ssh with? – nKn – 2015-09-21T18:10:15.393

Sure. I still feel like it's related to sshd's incompatibility when it comes to symlinks, but didn't find anything from the docs. – laur – 2015-09-21T18:14:29.910

Could you try running chmod 700 /data/progs/deps/homesick/repos/dotfiles/ssh/ && chown youruser:youruser /data/progs/deps/homesick/repos/dotfiles/ssh/ (replacing youruser, obviously) and try again? – nKn – 2015-09-21T18:17:57.907

Those were already the permissions of that dir. I use this little guy for fixing ssh-related perms issues:

function sanitize_ssh() {
    local dir="$@"

    chmod -R u=rwX,g=,o= "$dir";
}
 – laur  – 2015-09-21T18:23:14.570

If you add "-vvv" to your ssh command, it will print out (in great detail) everything that it is thinking and doing. Usually, there's something in there that gives a clue as to what it is not happy about. – wojtow – 2015-09-21T19:41:23.567

Yes, symlinks are not your issue. I routinely symlink the .ssh folder. I usually only get that message when my public key is not in the authorized_keys file – Isaac Hanson – 2015-09-30T02:39:32.433

No answers