Skip to content
MediumSecrets & credentialsBLWK-SSH-015

SSH private key can be read by other accounts: ‹path› ​

What this means ​

‹path› is a private SSH key with permissions ‹mode›, so other accounts on this computer, including services that run under their own account, can open it. ssh refuses to use a key in this state, and anyone who copies it can sign in wherever the key is accepted.

How to fix it ​

Make the key readable by you alone.

  1. Run chmod 600 ‹path›, and chmod 700 ~/.ssh for the folder.

bulwark fix ssh-perms --apply does both for every file in ~/.ssh and only ever removes access.

  1. If other people use this computer, or the key was open for a while, replace it: create a new key

with ssh-keygen -t ed25519, add its public key where the old one is accepted, then remove the old one.

Bulwark can do this for you

In the app, open the issue and use “Fix automatically”, or “Fix now” for every safe fix. From a terminal: bulwarkctl fix ssh-perms (preview), then bulwarkctl fix ssh-perms --apply.

Check it yourself ​

Run a scan and look for BLWK-SSH-015 in the results:

sh
bulwark scan

Installed the standalone CLI package instead of the app? The command is bulwarkctl.

How Bulwark decides

Bulwark reads ssh_private_keys and reports this check when:

text
open_to_others == true

If a value can't be read, Bulwark reports the check as undetermined rather than passing it. View the rule source.

References ​

Released under the Apache License 2.0.