SSH Key Forwarding
sshforwardingsecurity
SSH key forwarding allows you to use your local SSH keys when connecting to remote servers. This is particularly useful when you need to authenticate to other services (like GitHub or GitLab) from the remote server.
Common Use Case
I use SSH key forwarding with my home server for development. Since my server has dual GPUs, it's more efficient to develop and test code directly on it. With key forwarding enabled, I can seamlessly clone and push to Git repositories without storing SSH keys on the server.
Configuration
Add this to your ~/.ssh/config
:
Host homeserver.keninkujovic.com ForwardAgent yes
Security Note
Only enable key forwarding for trusted servers, as the remote server will have access to use your SSH keys while you're connected.
Testing the Setup
To verify it's working:
- SSH into your remote server
- Run
ssh-add -l
to list available keys - Try cloning a private repository