I have several Hosts in ~/.ssh/config, and they work fine from local machine, but remote machine doesn't know these Hosts.
Host A HostName github.com IdentityFile ~/.ssh/A_rsa Host B HostName github.com IdentityFile ~/.ssh/B_rsa Host remotemachine.com ForwardAgent yes
$ ssh -T git@A Hi A! You've successfully authenticated, ... $ ssh -T git@B Hi B! You've successfully authenticated, ...
From remote host:
$ ssh remotemachine $ ssh-add -l ... both keys present ... $ ssh -T git@B ssh: Could not resolve hostname B: Name or service not known $ ssh -T [email protected] Hi A! You've successfully authenticated, ...
How to use key B on remote machine?
That said, from local machine I'm able to do
ssh git@B, but on remote machine hostname
B is not known. Seems like ssh-agent forwards only keys, but not hosts. How to make it forward hosts too?
I could create ~/.ssh/config on remote machine too, but what to put into IdentityFile?
I could use
$ ssh -i KEYFILE, but what to put into KEYFILE if keys are forwarded?