Bit Breakdown for 600
Owner (6)
4 + 2 + 0 = 6
rw- (Read & Write)
Group (0)
0 + 0 + 0 = 0
--- (No Access)
Others (0)
0 + 0 + 0 = 0
--- (No Access)
Fixing "UNPROTECTED PRIVATE KEY FILE" in SSH
If you ever tried to connect to a server using ssh -i ~/.ssh/id_rsa user@host and received this error:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for 'id_rsa' are too open.
It is required that your private key files are NOT accessible by others.
Load key "id_rsa": bad permissions
Permission denied (publickey).
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for 'id_rsa' are too open.
It is required that your private key files are NOT accessible by others.
Load key "id_rsa": bad permissions
Permission denied (publickey).
The OpenSSH security daemon detects that other users on the operating system could theoretically read your cryptographic private key. To resolve this error instantly, run:
chmod 600 ~/.ssh/id_rsa
Other Files That Should Always Be chmod 600
- Environment Secrets: Production
.env,.env.production, orsecrets.yamlfiles storing API keys and JWT secrets. - Database Password Configs: WordPress
wp-config.phpor MySQL client defaults~/.my.cnf. - Shell History:
~/.bash_historyor~/.zsh_historywhich might inadvertently log plaintext command-line passwords.