I have 3 servers, lets call them A, B and C
Server C is behind a firewall and only server B can connect to it. Server B and C are under my control.
Now I want server A to connect to server C through server B: A -> B -> C
The problem is I can't change the command on server A which is probably just a simple ssh user@B.
I'm trying to forward the incomming connection using the command option in authorized_keys:
command="ssh user@C" ssh-rsa KEY
Whenever A makes a connection to B, I can see that a connection is made to C but A doesn't seem to realize this and timesout.
I have tried to add options -t,-t -t, -T or -N to the ssh command but to no avail. Is there any way to foreward the ssh connection in a way that server A thinks he is communication with server B.
The connection between B and C need to be triggered when A makes the connection to B and closed when A closes the connection.
All authentication is done using keys.
[edit]
To clarify: I can't control the command on Server A but as it is now, A does connect to B AND then B opens a connection to C. The problem here is dat A does not recognise that new connection. I think it doesn't get a prompt or something so that A knows there is a connection.
If I use this setup manually with
ssh user@B
it works and I'm directly logged in at C.