How do I forward a single arbitrary SSH key to a given host?

Forwarding keys is a security tradeoff, so when you do it, it's ideal to send only what you need.


Start up a ssh-agent just for this connection, add the desired key, then SSH in the subshell.

ssh-agent bash -c 'ssh-add /home/username/.ssh/some_key_id_rsa; ssh -A some_host'
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.