Setting up ssh keys is effectively very easy. You throw your pubkey in its own line in your $HOME/.ssh/authorized_keys file. However, you may not know that it matters very much the permissions that the following files have set:

  • home directory
  • .ssh directory
  • your authorized_keys file

After doing this multiple times, here is the corresponding combination that works for me:

  • 755, 750, or 700 (grp and other should have no write perms)
  • 700
  • 600

Also, of course, all of these directories and files must be owned by you.

Mario Loria is a builder of diverse infrastructure with modern workloads on both bare-metal and cloud platforms. He's traversed roles in system administration, network engineering, and DevOps. You can learn more about him here.