# Fix SSH Private Key Permissions Too Open Error

> Run chmod 600 on your private key file so it is readable and writable only by the current user

**URL:** https://sentry.io/answers/resolve-ssh-permissions-too-open-error/

---

## The Problem

When attempting to SSH into a remote machine, I receive the following error:

```
Permissions 0777 for '/Users/username/.ssh/id_rsa' are too open.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
```

How do I fix this? What permissions should `id_rsa` have?

## The Solution

`id_rsa` is a private key file, used in combination with a public key file (`id_rsa.pub`) to authenticate over SSH. Per the tenets of public-private key cryptography, the public key is distributed widely while the private key must be kept secret. For this reason, SSH requires private keys to be accessible only to the current user. The current permissions on the key, `0777`, mean that it is readable, writeable, and executable by the current user, members of that user's group, and members outside that user's group. This is far too permissive.

To fix this, we should set the key's permissions to 600, i.e. readable and writeable for the current user and inaccessible to all others. The private key file does not need to be executable. We can do this using `chmod`, as below:

```bash
chmod 600 ~/.ssh/id_rsa
```

After running this command, SSH should function as expected.

---

*Source: [sentry.io/answers/resolve-ssh-permissions-too-open-error/](https://sentry.io/answers/resolve-ssh-permissions-too-open-error/)*
