Fix Permissions for Private Key are Too Open with SSH

mail
Cyrus Kao
Last modified

Default file permissions on Linux is 777, which means everyone can read, write and execute the file. It's fine for most of the scenario, but it's another story when comes to SSH private key. If you try to establish a SSH connection with a too open private key, WARNING: UNPROTECTED PRIVATE KEY FILE! will be shown.

Error message
openssh with a permissions too open key

Solution

To solve the problem is quite easy, simply change your SSH private key's permissions.

In the following will take ~/.ssh/id_rsa as example, change it to your actual key path.

Read and Write

Or grant read and write permissions to the owner:

sudo chmod 600 ~/.ssh/id_rsa
Bash

Comments

0500