SSH Private Key Permissions Checker

See whether a Linux or macOS file mode gives anyone besides the owner access to an OpenSSH private key. Use the permission text from your terminal. It stays in this tab.

Enter a mode such as 0644, or paste one row from ls -lL ./key.pem. Use the file mode shown on your own computer.

Fix "Permissions 0644 are too open"

OpenSSH refuses a private key that other users can read and prints a warning like this:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/home/you/.ssh/id_rsa' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.

Remove group and other access, then connect again. Use chmod 600 ~/.ssh/id_rsa if you may edit the key, or chmod 400 ~/.ssh/id_rsa to make it read-only for you. Replace the path with the key named in the warning, such as a .pem file from a cloud provider. The same fix applies to mode 0755, 0664 or any other mode that lets the group or others read the key.

When to use chmod 400 or 600

Use chmod 400 ./key.pem for an owner-readable key or chmod 600 ./key.pem if the owner also needs to write to the file. Both clear group and other access. Mode 0644 gives group and other users read access and fails OpenSSH’s mode check when the key belongs to the account running SSH.

Check the owner in the same directory listing. If ls -l shows a symbolic link, read the target file’s permissions with ls -lL. Use the file you pass to the SSH client.