plain/devtools home

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.

chmod-calculatorsamplesCtrl↵ run · s sample
WhoReadWriteExecuteSpecial
Owner (u)
Group (g)
Others (o)

never leaves your browser

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_keys

What 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 -l shows your own user, and fix with chown if 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

Related

esc
↑↓ move↵ open? all shortcuts

Keyboard shortcuts

Cmd or Ctrl shortcuts always work.
Everywhere
Everywhere
Open the command palette
CtrlK
Open the palette (outside a text field)
/
Show these shortcuts
?
Toggle light and dark theme
t
Go home
gh
Go to all tools
gt
On a tool page
On a tool page
Run the main action
Ctrl↵
Copy the output
c
Load the next sample
s
Focus the input
i
Leave a text field
Esc
Previous or next tool
[]
In the palette
In the palette
Move the selection
↑↓
Open the selected item
↵
Close
Esc