File permissions for successful SSH login via authorized_keys

cover
Caveat Lector: This blog post was published 11 years ago. Depending on the content, it may no longer be applicable or relevant.

If you want to ssh into your server without being repeatedly prompted for the password you can copy your public ssh key into a file called authorized_keys in the .ssh subdirectory of the user’s home directory. However, this works only if the permissions for this file are set correctly. Otherwise, it will keep asking for the user’s password.

  • The permissions of the home directory of the remote user must be 755
  • The permissions of the remote .ssh directory must be 700
  • The permissions of the remote authorized_keys file must be 600

Of course all of those must be owned by the remote user, and not by root.

If you found a mistake in this blog post, or would like to suggest an improvement to this blog post, please get in touch at michael@franzl.name; as subject please use the prefix "Comment to blog post" and append the post title.
 
Copyright © 2023 Michael Franzl