Fix SSH "Bad owner or permissions" errors (the right chmod for ~/.ssh) — by Robert on Server Fault
SSH refuses config and key files that other users could read or write. The answer sets the config to 600, checks the files belong to you, and includes a table of the correct permissions for the .ssh folder (700), private keys (600) and other files.
Quick steps
- chmod 700 ~/.ssh
- chmod 600 ~/.ssh/config ~/.ssh/id_* (private keys)
- chown $USER ~/.ssh/config
Paraphrased from the source. Menus can differ by version, so check the original for full details.
Source: Fix SSH "Bad owner or permissions" errors (the right chmod for ~/.ssh) by Robert on Server Fault. Licence: CC BY-SA (Stack Exchange; version depends on post date).
- Source reviewed
- 2026-11-02
- Link checked
- Not yet
- Tested hands-on
- Not by Oddbyte.Me