File permissions for successful SSH login via authorized_keys

cover
This blog post was published 10 years ago and may or may not have aged well. While reading please keep in mind that it may no longer be accurate or even 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 think you found a mistake in this blog post, or would like to suggest an improvement to this blog post, you can write me an e-mail to the address public dot michael at franzl dot name; as subject please use the prefix "Comment to blog post" and append the post title.
 
Copyright © 2023 Michael Franzl