Gregg's MOTD

Tips & Tricks that I've Encountered Over the Years...

SSH Directory Permissions Settings

May 13, 2023 — Gregg Szumowski

It is important to set the directory and file permissions for your ~/.ssh correctly.

Typically you want the permissions to be:

  • .ssh directory: 700 (drwx------)
  • public key (.pub file): 644 (-rw-r--r--)
  • private key (id_rsa): 600 (-rw-------)
  • lastly your home directory should not be writeable by the group or others (at most 755 (drwxr-xr-x)).


For example, to set this permissions do:
$ chmod 700 ~/.ssh
$ chmod 600 ~/.ssh/*
$ chmod 644 ~/.ssh/*.pub
$ ls -ltr ~/.ssh/

Tags: ssh, motd