SSH to remote host using SOCK5 proxy

I am trying to connect to a remote host C from my node host A.

HostA <====> HostB <====> HostC

A tunnel has already been formed using SOCKS5 between HostA and HostC.

Now I want to SSH from A to C. The SOCKS5 IP us 142.133.132.161 and port 1082.

The command I am using is :

ssh -L 22:142.133.132.161:1082 myuser@10.29.53.71

But it seems like I cannot SSH to the remote node. Any ideas what I might be missing here ?

You can try something like that:

ssh -L 6666:localhost:6666 user@serverA

Then you'll need to run following from the serverA:

ssh -L 6666:serverC:22 user@serverB

In the result, your local port 6666 will tunnel to serverA, and the port 6666 from the serverA will tunnel to serverB, and finally to sercerC:22 (SSH port).

You can also find more examples here as well.