The ProblemYou try to log into a remote server, but instead of a password prompt, you get a wall of text. SSH refuses to connect because your private key is too "exposed." To protect your credentials, the OpenSSH client simply ignores the key and blocks the connection.
Permissions 0644 for '/home/user/.ssh/id_rsa' are too open.
Why This HappensSSH is strict about security. Your private key is like a physical master key to your house. If your file permissions allow other users on your local machine to read it, SSH considers the key compromised.
In the error above, the permissions are 0644. Here is what those numbers actually mean:
- 6 (You): Can read and write the file.- 4 (Group): Other users in your group can read it.- 4 (World): Anyone else on the system can read it.If you downloaded a
.pemfile from AWS or moved a key from a Windows partition to Linux, the system often defaults to these broad permissions. SSH requires that only you have access.
The Solution### 1. Check Current PermissionsStart by verifying the current state of your key. Run this command in your terminal:
ls -l ~/.ssh/id_rsa
If you see -rw-r--r--, it means the file is readable by everyone. We need to tighten that down.
2. Restrict the Key FileThe standard permission for a private key is 600. This gives you full access but locks everyone else out. Run the following:
chmod 600 ~/.ssh/id_rsa
If your key has a different name, like deploy-key.pem, make sure to use that filename instead. Once applied, ls -l should show -rw-------.
3. Secure the .ssh DirectorySometimes the file is fine, but the folder containing it is too open. Your ~/.ssh directory should be set to 700 (read/write/execute for the owner only). Fix it with this command:
chmod 700 ~/.ssh
4. Test the ConnectionTry connecting again:
ssh -i ~/.ssh/id_rsa user@192.168.1.100
The warning should vanish, and you should be prompted for your passphrase or logged in immediately.
Special Case: Windows Subsystem for Linux (WSL)Are you using WSL? If your key is stored on a Windows drive (like /mnt/c/), the chmod command might fail silently. This happens because Windows drives use a different file system (NTFS) that doesn't map perfectly to Linux permissions.
The easiest fix is to move the key into your Linux home directory:
cp /mnt/c/Users/YourName/.ssh/id_rsa ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa

