Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

key
ssh
error
permissions
key

SSH error: permissions are too open

Anusheh Zohair Mustafeez

When working with SSH’s private/public key pair, users often come across the following error:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions for '/Users/username/.ssh/id_rsa' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.

Here, '~/.ssh/id_rsa' can be replaced with the path to the user’s private key.

Why does this error show up?

This error is meant to inform users that the permissions for their private key need to be changed and made more secure. As the name implies, a private key must be kept private and is only accessible to the user themselves.

Solution

Luckily for us, we can update the permissions with the help of some simple chmod commands.

If we want our private key to be readable by the logged in user, we will use the following command:

chmod 400 ~/.ssh/id_rsa

If we want our private key to be both readable and writable by the logged in user, we will use this command instead:

chmod 600 ~/.ssh/id_rsa

For windows, when you download the key file, make sure you move to the directory with Sudo privileges, i.e., in the C user directory.

svg viewer

RELATED TAGS

key
ssh
error
permissions
key

CONTRIBUTOR

Anusheh Zohair Mustafeez
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring