Although not an exact match, here are a couple of other closely related questions:
- how to access an ssh server that cant accept incoming connections
- establishing an ssh connection between machines behind firewalls
To solve your specific problem, I would add the following to your .ssh/config
file on "A":
Host B
User abc
ForwardAgent yes
Host C
User root
LocalForward 3306:localhost:3306
ProxyCommand ssh -A B -p 22 -W %h:%p
#ProxyCommand ssh -A B -p 22 nc %h %p
With that in place, you should be able to use ssh C
to:
- get a shell on C, hopping through B, and
- establish a local (to host A) port forward for your mysql workbench.
Once the connection is established, you can point your local (on A) mysql workbench at localhost:3306. If you have some other mysql instance running locally on A, choose a different port in the LocalForward
configuration option and connect to that.
Note that there are two options for the ProxyCommand to jump through B to get to C. The alternative uses nc
instead of the -W
option to ssh
, since the -W
option wasn't addded unitl ssh version 5.3 (IIRC).
You don't need to use a SOCKS proxy.