SSH agent forwarding is dangerous. Here's how to secure it.
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