I have a MySQL server sitting behind a bastion server that I wish to connect to from my local machine.
Ideally I want to port-forward the MySQL port (3316 in this case) to a local port on my machine.
I've tried plink -ssh -L 3306:my.sql.ip.address:3316 my.bastion.server ,but this is not working.
I've got one ssh login for the bastion server and another login for the machine mysql server is running on.
-
You can double-chain SSH port forwards, bit a slightly easier method is to set up a "proxy" config in
.ssh/config:Host *%proxy ProxyCommand ssh proxy-user@proxy.host "nc -w1 $(echo %h | cut -d%% -f1) 22" ForwardAgent yes StrictHostKeyChecking noThen use
ssh -L 3306:127.0.0.1:3316 final-user@final.host%proxyto bring up the seesion.I use this all the time, although normally with dyanamic port forwards (
-D 1080) to get to management modules of hosts behind overly restrictive firewalls.From LapTop006
0 comments:
Post a Comment