Thanks for this. Wanted to put in a pitch for Dima Kogan's more-secure way of doing ssh-agent forwarding: <a href="https://github.com/StanfordSNR/guardian-agent" rel="nofollow">https://github.com/StanfordSNR/guardian-agent</a><p>It works with SSH and Mosh. The basic idea is that before agreeing to a request, the principal or their agent should know (a) what machine is asking, (b) what remote machine they want to connect to, and (c) what command line they want to run on the principal's behalf. And the principal's authorization should then be limited to that context.<p>The ssh-agent protocol doesn't give the agent <i>any</i> of that information; it's really just intended for local SSH-like processes to ask "please sign this blob so I can connect somewhere" without them having to see the plaintext private key. Forwarding that to untrusted remote machines isn't ideal.<p>It turns out an agent can get access to this information and limit the scope of authorization in a mostly[1] backwards-compatible way, which is how guardian-agent works, but imo it would be preferable if a future version of the SSH protocol were designed more expressly for secure agent forwarding.<p>[1] For (c), the remote server has to be OpenSSH because guardian-agent relies on a nonstandard extension.