chmod 600 for SSH keys
Run chmod 600 ~/.ssh/id_ed25519 (use your key name). OpenSSH refuses a private key that other users can read, so 600 (rw-------) is the fix. Also set the ~/.ssh folder to 700.
Last reviewed 2026-11-04.
| Who | Read | Write | Execute | Special |
|---|---|---|---|---|
| Owner (u) | ||||
| Group (g) | ||||
| Others (o) |
The error
When a private key file is readable by group or others, ssh prints WARNING: UNPROTECTED PRIVATE KEY FILE! and Permissions 0644 for 'id_rsa' are too open, then ignores the key.
Worked example
Set the usual modes:
$ chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_ed25519
chmod 644 ~/.ssh/id_ed25519.pub
chmod 600 ~/.ssh/authorized_keysWhat each mode allows
- 600 (rw-------): Owner: read, write; Group: no access; Others: no access.
- 400 (r--------): Owner: read; Group: no access; Others: no access. Also accepted by ssh; it protects the key from your own accidental edits.
- 700 (rwx------) on the folder: only you can enter it.
- 644 on the public key is fine, since it is meant to be shared.
Common mistakes
- Changing the key while the folder is open to others. Set the folder to 700 too.
- Using a key stored on a Windows or shared mount that cannot hold Unix permissions. Copy it into your home directory first.
- Setting the wrong owner. Check
ls -lshows your own user, and fix withchownif not.
Running this on a server
Key permissions are the first thing to get right when you log in to a new server. A VPS from any provider uses SSH keys this way; the hosting guide compares them.
Frequently asked questions
Should the key be 600 or 400?
Either works for ssh. 600 lets you edit or rewrite the file as yourself; 400 is read-only for you.
Do I need chmod on Windows?
Native Windows OpenSSH uses file ACLs instead. Inside WSL, keep the key in the Linux filesystem and use chmod 600.
What if the error persists after chmod 600?
Check the owner with ls -l, check the folder is 700, and confirm the file is on a filesystem that stores Unix permissions.
Sources
- ssh(1) manual page: Files section checked 2026-11-04
- chmod(1) manual page checked 2026-11-04