Locally, I've turned on the SSH agent and I've added my key:
-
$ eval $(ssh-agent)
Agent pid 80
-
$ ssh-add
Identity added: /c/Users/...../.ssh/id_rsa (.....@........)
In my ~/.ssh/config
, I have this:
Host example
User root
HostName 123.45.678.912
ForwardAgent yes
Once I run ssh example
, I am successfully connected and if I make a remote test connection to GitHub, I can see that I'm authenticated using my forwarded key:
root@example:~# ssh -vT [email protected]
OpenSSH_8.2p1 Ubuntu-4ubuntu0.5, OpenSSL 1.1.1j 16 Feb 2021
...
debug1: Will attempt key: .....@........ RSA SHA256:abc123/123456abcdefghi/abcdefg12+abcdefghij agent
...
debug1: Offering public key: .....@........ RSA SHA256:abc123/123456abcdefghi/abcdefg12+abcdefghij agent
debug1: Server accepts key: .....@........ RSA SHA256:abc123/123456abcdefghi/abcdefg12+abcdefghij agent
debug1: Authentication succeeded (publickey).
...
Hi ......! You've successfully authenticated, but GitHub does not provide shell access.
Is there a way to determine, on the remote machine, if agent forwarding works, without such a test connection?
This answer suggested using $SSH_AGENT_PID
, but it's empty, on both the local and remote machine.