Where Are SSH Keys Stored?
Default .ssh folder paths on Windows, macOS and Linux, where id_ed25519, config and known_hosts live on each system.
Last updated
SSH looks in a .ssh folder inside your home directory on every major OS. Private keys like id_ed25519, the client config file and known_hosts all live there. The server side uses /etc/ssh instead, a separate tree beginners mix up.
Permissions matter as much as location. Keys must be readable only by you or SSH refuses them with an UNPROTECTED error. On Windows, the bundled OpenSSH client uses the same home folder layout as Mac and Linux, so skills transfer directly.
Where SSH stores this, by platform
C:\Users\[Username]\.ssh
Holds id_ed25519, id_rsa if older, config and known_hosts. Edit the config file with Notepad to set per host keys and usernames.
~/.ssh
Same files as Windows. Run chmod 700 ~/.ssh and chmod 600 ~/.ssh/id_* if SSH warns about open permissions. Mac Keychain can store key passphrases.
~/.ssh
Client keys here, server config in /etc/ssh/sshd_config. Keep authorized_keys at ~/.ssh/authorized_keys with 600 permissions for logins to work.
Frequently asked questions
Why does SSH say permissions are too open for my key?
The private key is readable by others. Run chmod 600 on the key file and chmod 700 on ~/.ssh, then retry. On Windows, remove extra users in the file Security tab.
Where is the SSH server config, not my keys?
On macOS and Linux the daemon reads /etc/ssh/sshd_config. Client settings are separate in ~/.ssh/config. Restart sshd after editing the server file.
Notice an outdated path? Let us know.