# Your SSH Keys Are Sitting on Disk, Waiting to Be Stolen

Original title: You can't afford to keep your SSH keys on disk

> Hacker News story 50609579 · language: en · submitted 2026-11-23
> Web version: https://zeli.app/story/50609579
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 146 · by [shintoist](<https://news.ycombinator.com/user?id=shintoist>) · 💬 96
[original](<https://jola.dev/posts/you-cant-afford-ssh-keys-disk>) · [HN discussion](<https://news.ycombinator.com/item?id=50609579>)

## Summary

After tightening security across his self-hosted servers, a long-time password manager user realized his SSH private keys were still sitting unprotected on disk, easy prey for any malicious code that scanned the drive. He walks through moving them into Bitwarden's SSH agent, pointing ssh and terminal tools at its socket, deleting the on-disk copies, and adding SSH-based git commit signing, where each commit and push needs two separately authorized keys. After a couple of weeks, the only friction is the occasional approve prompt.

## Key quote

> To just make this absolutely clear, this means that the private keys are vulnerable to be exiltrated by malicious code scanning my disk.

## HN discussion (96 comments)

### [handplane](<https://news.ycombinator.com/item?id=50613931>)

> While in theory, this adds at least some small layer of protection, I have doubts that it adds anything meaningful to stop a smart attacker.
>
> The problem here is that everything is running as your user, so it's all the same security sphere.
>
> You may be thinking, "But Bitwarden requires me to approve each key request". Problem is that if the attacker is already running as your user, which I'm assuming here because to steal your bare keys, they'd already need to be. This means they can also hit the approve button for you.
>
> Ok, now you say "But it requires touchID!". Maybe that gets you just a little bit of protection, but...
>
> The next idea is to just steal the decrypted key out of RAM. This requires a little bit of effort, because you generally can't attach to a sibling process without root on Linux with default configs. This will only delay things slightly. Attaching to your child is allowed, so all an attacker needs to do is replace your launch shortcut/service for Bitwarden with a thin wrapper that makes the attacker the parent process, and then they can just ptrace it and steal the decrypted key next startup. On Mac, where the ptrace path isn't viable due to disallowing ptrace of signed binaries by default, you could just replicate the Bitwarden GUI as a wrapper and steal the master password at startup.
>
> If you really want to protect your keys from attacks like this, you need a real hardware device with OOB signaling.

### [binarin](<https://news.ycombinator.com/item?id=50618618>)

> I just can't stop preaching SSH certificates everytime similar discussions come up - they have expiration date, the scope can be as granular as possible. Then everything can be encoded:
>
> \- Daily cert for unprivileged daily work, with 24 expiration
>
> \- A 10-minute root access to a single server
>
> And any combination of things in-between - it all depends only on you imagination (or paranoia:) )
>
> The downside is that you can only use it on the infra you control, i.e. GitHub will never trust ssh CA your are using for cert signing. But speaking of git forges, at least self-hosted forgejo supports ssh certs natively.

### [201984](<https://news.ycombinator.com/item?id=50613505>)

> Why not just use the regular SSH agent with a password? Still encrypted on disk, so I don't see what the difference is.

### [mmulqueen](<https://news.ycombinator.com/item?id=50615527>)

> Yubikey or another removable security key is the way to go in my opinion. I've been doing this since I think 2018. There are few ways you can do it, I've always used the GPG key option - you have the GPG key irretrievably on the Yubikey, you set up SSH to talk to gpg-agent and you have to provide a PIN every time you plug the USB back in. When I walk away, the Yubikey goes with me. I've never had a problem getting it working with anything on Linux or any external service. You can either let existing sessions continue or there are ways you can break existing sessions when the key is unplugged. Works on Windows and macOS too, from memory, macOS was almost as easy as Linux and Windows is more fiddly.
>
> By having it as a GPG key, you get signing and encryption on top of SSH. You can pair it with gopass as a password vault.
>
> I haven't had to make a new key for years, they're very hard-wearing, mine lives on my key ring with my house keys. But I wrote this script to automate setting up a new key, I haven't tested it with recent Yubikeys or a recent version of GPG, but might be a useful starting point: https://github.com/Method-B-Ltd/auto-gpg-card - PRs welcome if it's broken.
>
> You still need to be really careful about what can run as your user, but being able to take the key away physically remove a load of risk.

### [rosencrantz](<https://news.ycombinator.com/item?id=50618440>)

> Someone said "Software should not need a manual"
>
> He was right! As soon as a procedure is awkward or even looks like it might not work the first time I will deem it to be wrong.
>
> Wrong because I don't want to learn another way and I don't need to learn another way than what is supposed to be the obvious way and if that is not immediately obvious to the user (customer) then I'm not going for it.

---

## Cite

- Page: https://zeli.app/story/50609579
- Date: 2026-11-23
- Source: jola.dev (https://jola.dev/posts/you-cant-afford-ssh-keys-disk)
- Hacker News: https://news.ycombinator.com/item?id=50609579

## Other languages

- zh: https://zeli.app/zh/story/50609579 · markdown: https://zeli.app/zh/story/50609579.md
- ja: https://zeli.app/ja/story/50609579 · markdown: https://zeli.app/ja/story/50609579.md
- ko: https://zeli.app/ko/story/50609579 · markdown: https://zeli.app/ko/story/50609579.md
- de: https://zeli.app/de/story/50609579 · markdown: https://zeli.app/de/story/50609579.md
- es: https://zeli.app/es/story/50609579 · markdown: https://zeli.app/es/story/50609579.md
- ru: https://zeli.app/ru/story/50609579 · markdown: https://zeli.app/ru/story/50609579.md
