Proper Permissions of ~/.ssh

If you accidentally changed the permissions of your ~/.ssh folder, or created the folder without setting the appropriate permissions your operating system may not be able to read your private key files. In order to prevent them from being read by other accounts, it’s important to set the appropriate permissions on both Private and Public Keys.

Here are the appropriate permissions to have on your ~/.ssh and its standard files.

  • ~./ssh (drwx——) – 600
  • ~/.ssh/authorized_keys (drwx——) – 600
  • ~/.ssh/[Private Key] (-rw——-) – 600
  • ~/.ssh/[Public Key] (-rw-r–r–) – 644
  • ~/.ssh/known_hosts (-rw-r–r–) – 644

You can test your identity file using the ssh to connect to the account on the server that the private key is associated with.

~$ ssh churppy@[Server] -i ~/.ssh/[Private Key]

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.