# SSH agent forwarding is dangerous. Here's how to secure it. — retained record

> Retained reddit record from reddit:selfhosted.

Canonical: https://highsignal.app/data/records/eaa23a0d781597f4

[← sources](https://highsignal.app/data)


source: [reddit](https://highsignal.app/data/reddit) (reddit:selfhosted)  published 2026-11-17 14:20 ingested 2026-11-18 02:38

[original source ↗](https://www.reddit.com/r/selfhosted/comments/1xyln75/ssh_agent_forwarding_is_dangerous_heres_how_to/)

## retained text



```
https://kimhq.net/blog/secure-ssh-agent-forwarding/

I needed to deploy my git-synced dotfiles on an untrusted server, but didn't want to store the credentials or ssh-agent-forward all my keys.

The fix ended up being:

1. ssh-agent-filter, a small proxy agent that only exposes the keys you choose
2. The somewhat new \`ForwardAgent <socket path>\` option that was added in OpenSSH 8.2

Together, your real agent handles authentication, and only a filtered agent gets forwarded.

The article also covers the 2019 Matrix.org breach, which was a good example of how agent forwarding can be exploited.

Curious whether anyone has a better approach.

**AI Usage Disclosure:**

This article was handwritten by me (like in the olden days).

AI agents were used for the feature image, light editing, spell-checking, research, and the development of the presented solutions.
```



document fetched 2026-11-18 00:30 · canonical https://reddit.com/r/selfhosted/comments/1xyln75/ssh_agent_forwarding_is_dangerous_heres_how_to
