SSH pubkey fun

I had an interesting issue today where I was not able to use ssh key pairs to log into a box. It turns out that I had loose permissions on the home folder and ssh was silently failing.

So with that in mind, here is my guide to file system permissions for successful ssh authentication.

The home directory must not be writable for the world, but locking writes down to your user is probably a good thing too. the .ssh folder inside your home folder must be no looser than 0755 and the files inside .ssh *should* be 0600 to keep things nice and locked down tight.

chmod 755 /home/user
chmod 755 /home/user/.ssh
chmod 600 /home/user/.ssh/*

The home folder permissions is what tripped me up today, but a quick google and then chmod sorted that out for me.